1
나는 약간의 문제가있다. 나는 PHP와 관련해서는 최고가 아니며 PHP로 무언가를하고 싶습니다. 하하. 동영상 업로드 스크립트를 만들었고 업로드가 완료되면 업로드 한 동영상으로 사용자를 보내려고합니다.파일 업로드 후 PHP 리다이렉트
<?php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
// Check if image file is a actual image or fake image
/* if(isset($_POST["submit"])) {
$check = getimagesize($_FILES["fileToUpload"]["tmp_name"]);
if($check !== false) {
echo "File is a movie/video - " . $check["mime"] . ".";
$uploadOk = 1;
} else {
echo "File is not a movie/video.";
$uploadOk = 0;
}
} */
// Check if file already exists
if (file_exists($target_file)) {
echo "Sorry, file already exists.";
$uploadOk = 0;
}
// Check file size
if ($_FILES["fileToUpload"]["size"] < 500000) {
echo "Sorry, your file is too small.";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
echo "The file ". basename($_FILES["fileToUpload"]["name"]). " has been uploaded.";
} else {
echo "Sorry, there was an error uploading your file.";
}
}
?>
echo "The file". basename ($ _FILES [ "fileToUpload"] [ "name"]). "업로드되었습니다."; // 업로드하는 곳입니다. –
'header ('Location : path/to/video')를 기본으로 사용합니다; exit;' – JOUM
물론, 어떻게하면 새로운 비디오의 확장자와 파일 경로를 추가 할 수 있습니까? 마찬가지로 하나의 파일이 'header ('Location : uploads/fileuploaded.extension ')로 리디렉션됩니다. 출구;' –