Jump to content

Upload Video Problem


absorr

Recommended Posts

I created something to upload videos but it won't work. <?php if ($_FILES["file"]["error"] > 0) { echo "Return Code: " . $_FILES["file"]["error"] . "<br />"; } else { echo "Upload: " . $_FILES["file"]["name"] . "<br />"; echo "Type: " . $_FILES["file"]["type"] . "<br />"; echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />"; echo "Temp file: " . $_FILES["file"]["tmp_name"] . "<br />"; if (file_exists("/" . $_FILES["file"]["name"])) { echo $_FILES["file"]["name"] . " already exists. "; } else { move_uploaded_file($_FILES["file"]["tmp_name"], "/" . $_FILES["file"]["name"]); echo "Stored in: " . "/" . $_FILES["file"]["name"]; $a_str = array($_POST["fname"],$_POST["age"],$_POST["alb"],$_FILES["file"]["name"]); $contents = implode(PHP_EOL, $a_str); $contents .= PHP_EOL . PHP_EOL; file_put_contents("videos.html", "<br><b>{$_POST['fname']}</b><video height=\"400\" controls=\"controls\"><source src=\"{$_FILES['file']['name']}\" type=\"video/{$_FILES['file']['type']}\" /><object data=\"{$_FILES['file']['name']}\" width=\"320\" height=\"240\"><embed src=\"movie.swf\" width=\"320\" height=\"240\">FAIL! Your browser can not handle this video</object></video><br><u>Description</u> <p>{$_POST['age']}</p><br>", FILE_APPEND); print("|$contents|"); } }?> and here is what it said when i tried uploading an mp4 file: Upload: Type: Size: 0 KbTemp file: already exists. I looked in my folder and there was no video there. What is wrong? How can I fix it?

Link to comment
Share on other sites

It looks like the file isn't even coming over the wire. what about the HTML? I assume you are using a typical file input type? have you set the appropriate enctype?http://www.w3schools.com/php/php_file_upload.asp

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...