My code was uploading video files, but after I extended the form it stopped uploading. All the other variables were passed OK but not the file variable was blank.
I tried comparing the upload logic with similar examples on the web but could not see what I had changed to cause it to fail. In the listing below I have removed all the irrelevant code. When this code runs it returns “Error”.
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
if (isset($_FILES['urlvideo'])) {
move_uploaded_file($_FILES['urlvideo']['tmp_name'], "{$_FILES['urlvideo']['name']}");
} else {
echo('Error');
exit();
}
?>
<!DOCTYPE HTML>
<html>
<body>
<form action="videotest.php"
method="post"
enctype="multipart/form-data">
Upload video:
<input type="file" name="urlvideo" /><br>
<input type="submit"
value="Submit"/>
</form>
</body>
</html>
<?php ob_end_flush(); ?>
Thank you for taking the time to read this.
use this code.
it is because you put if ( isset( $_FILES before showing the form.