上传文件后的PHP重定向页面 [英] PHP redirect page after files are uploaded
本文介绍了上传文件后的PHP重定向页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我希望在文件上传后重定向回我的主页,我目前有一个 echo 语句,表明文件已上传(完成后).任何帮助将不胜感激!
Im looking to redirect back to my home page once files have been uploaded, I currently have an echo statement indicating that a file has been uploaded (when done so). Any help would be greatly appreciated!
<?php
$tags[]= $_POST['Sport'];
$tags[]= $_POST['bcTags1'];
$tags[]= $_POST['bcTags2'];
$tags[]= $_POST['bcTags3'];
$tags[]= $_POST['hiddenTag'];
$metaData = array(
'name' => $_POST['bcVideoName'],
'shortDescription' => $_POST['bcShortDescription'],
'tags' => $tags
);
# Rename the video file
$file = $_FILES['theVideoFile'];
rename($file['tmp_name'], '/tmp/' . $file['name']);
$file_location = '/tmp/' . $file['name'];
# Send video to Brightcove
$id = $bc->createMedia('video', $file_location, $metaData);
echo $id.'Uploaded Successfully!';
?>
推荐答案
header("Location: yourscript.php");
die();
这将重定向,但必须在回显任何内容之前使用它.
This will redirect, but it has to be used before ANYTHING has been echoed.
这篇关于上传文件后的PHP重定向页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文