PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Now I have another interesting dilemma...it seems that in Firefox the file only uploads successfully if the file input is in the same fieldset as the submit button. Why is this happening?
JAB Creations wrote:Thanks, I found that two seconds after I posted.
Now I have another interesting dilemma...it seems that in Firefox the file only uploads successfully if the file input is in the same fieldset as the submit button. Why is this happening?
No way. It has got to be something else, the fieldset tag couldn't possibly affect that. Can you post the offending HTML?
After some troubleshooting it looks like you're only allowed to have a single file input per form? That makes no sense however as for example Yahoo mail allows users to upload multiple files.
The issue was that I had two fieldset's (side by side) one for an avatar file upload and another for a profile picture upload. I added more file inputs and it seems like only the last file input would actually send the file.
What do I have to do to have browsers (same result also on Opera) allow two or more file input/uploads for a single form then?
Gah...durr...RETARD! Same name values for each file input. This is why I prefer to stay up until the mid-morning instead of starting to work with code at that time.
Ok so I *hope* this is the last issue: the file seems to upload fine but PHP fails to move the file...thus it gets deleted (as files not moved after being uploaded are deleted from what I've read.)
$uploaddir = '/home/jabcreat/public_html/members/upload/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}
echo 'Here is some more debugging info:';
print_r($_FILES);
print "</pre>";
I've set the permissions on the PHP file's directory, the PHP file itself, and the folder to which the uploaded file should be moved to. So I'm not sure what else...I'm slowly going through comments on php.net right now without any luck thus far. Suggestions?
The only person who would ever see that message would be the potential attacker, wouldn't it? Its like an alarm system that quietly whispers on the burglar's ear "You are currently trying to break into my house".
It's a copy and paste sort of deal. I learn by taking working scripts and taking them apart. I'm not good with working with things that don't have at least minimally working examples. I'm also not getting any error messages except this with E_ALL...
Notice: Undefined index: userfile in profile.php on line 226
I did that though deleted the upload folder, updated the script and got the following error...
Warning: move_uploaded_file ... failed to open stream: Permission denied
Then I set the permissions to 777 and I saw the file in the FTP! SUCCESS! The lowest permissions this seems to work with is 707. Thanks for the help! I was not making the connection with the <input name="example" /> and $_FILE['example'];