in the form page:
input type=“file” name=“uploadvideo” id=“upvideo”
input type=“file” name=“upload” id=“upimage”
in the index page:
var_dump($_FILES);
if( !is_uploaded_file($_FILES['upload']['tmp_name']) or !is_uploaded_file($_FILES['upvideo']['tmp_name'])) {
$error = "form not complete.";
....
}
The result of var_dump($_FULES) is:
array (size=2)
‘upload’ =>
array (size=5)
‘name’ => string ‘5.jpg’ (length=5)
‘type’ => string ‘image/jpeg’ (length=10)
‘tmp_name’ => string ‘C:\wamp\tmp\phpADB8.tmp’ (length=23)
‘error’ => int 0
‘size’ => int 4103
‘uploadvideo’ =>
array (size=5)
‘name’ => string ‘Heliken.mp4’ (length=11)
‘type’ => string ‘video/mp4’ (length=9)
‘tmp_name’ => string ‘C:\wamp\tmp\phpADB9.tmp’ (length=23)
‘error’ => int 0
‘size’ => int 6201012
However, I got the error which is “form not complete”. And I’m sure the error is caused by the videoupload.
What can I do to solve this problem?
I’m not a PHP wizard, but is it possible that you have to use $_FILES[‘uploadvideo’] instead of $_FILES[‘upvideo’]
–EDIT–
This works here, so I guess it really is because you used the id of the input element while you have to use it’s name.
<form enctype="multipart/form-data" method="POST" action="<?php echo $_SERVER["PHP_SELF"] ?>">
Upload video:<input type="file" name="uploadvideo" id="upvideo" />
upload image:<input type="file" name="upload" id="upImage" />
<input type="submit" value="Upload" name="btnUpload" />
</form>
<?php
if(isset($_POST["btnUpload"])) {
echo "<pre>";
var_dump($_FILES);
echo "</pre>";
echo "<hr />";
if (!is_uploaded_file($_FILES["uploadvideo"]["tmp_name"]) or !is_uploaded_file($_FILES["upload"]["tmp_name"])) {
echo "Upload failed!";
} else {
echo "Upload succesful!";
}
}
?>
2 Likes
system
Closed
3
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.