Forum Moderators: coopster
I am currently getting this error.
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in C:\Program Files\Apache Group\Apache2\htdocs\FYP\loademup.php on line 30
Line 30 happens to be: print "<strong>$_FILES['userfile']['name'][$q]</strong> did not upload!";
And when I removed it, this happens: Notice: Undefined variable: userfile in C:\Program Files\Apache Group\Apache2\htdocs\FYP\loademup.php on line 12
1) print "<strong>".$_FILES['userfile']['name'][$q]."</strong> did not upload!";
or
2)
print "<strong>{$_FILES['userfile']['name'][$q]}</strong> did not upload!";
The notice you are getting means the vriable you use on line 12 called userfile has not yet been defined.
This is line 12: $tot = count($userfile);
Yes, I've noticed that it is not defined yet.
I tried $userfile = $_POST["userfile"];
and $userfile = $_POST["userfile[]"];
But both don't work.
The form is as follows:
<form enctype="multipart/form-data" action="loademup.php" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="300000">
<input name="userfile[]" type="file" /><br />
<input name="userfile[]" type="file" /><br />
<input name="userfile[]" type="file" /><br />
<input type="submit" />
</form>
Or can someone direct me to another similar script?
One that creates thumbprint, allows upload of all picture types, etc...
And thats why the error is occurring. Try using isset() before you use the userfile variable. Also, use $_FILES and not $_POST.
if (isset($_FILES['userfile']))
{
//execute the loop and do rest of code
}
also as its an array, try using empty to determine if the array contains data
if (isset($_FILES['userfile']) &&!empty($_FILES['userfile']))
{
//execute the loop and do rest of code
}
I was just browsing the forum and came across this code for image upload [webmasterworld.com]. The codes are short and simple. Just what I need. I had managed to make it upload pictures for me.
But is it possible to make it create a thumbnail for me too?