Jump to content

Recommended Posts

You should be able to do something like this:

 

if(move_uploaded_file($_FILES['file_upload']['temp_name'], 'files/'.$_FILES['file_upload']['name'])){
echo "File was uploaded";
}else{
echo "File was not uploaded";
}

 

My point is, UPLOAD_ERR_INI_SIZE will never get used because an over-sized file will cause $_FILES to be an empty array. Bug, maybe?

Link to comment
https://forums.phpfreaks.com/topic/237646-how-on-earth/#findComment-1221179
Share on other sites

@TLG, when validating user supplied data, it is important to tell the user exactly what was wrong with the data they supplied (as long as you are not exposing security related information). Just telling them that some data they supplied didn't work is a useless waste of bandwidth.

Link to comment
https://forums.phpfreaks.com/topic/237646-how-on-earth/#findComment-1221180
Share on other sites

The quote I posted in your other thread on this subject, is directly out of the post_max_size documentation. It's not a bug, its the defined response that php takes -

 

If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty.
Link to comment
https://forums.phpfreaks.com/topic/237646-how-on-earth/#findComment-1221181
Share on other sites

The quote I posted in your other thread on this subject, is directly out of the post_max_size documentation. It's not a bug, its the defined response that php takes -

 

If the size of post data is greater than post_max_size, the $_POST and $_FILES superglobals are empty.

 

Yea, I get that. I just think it's odd that they created UPLOAD_ERR_INI_SIZE when it can never be used. Also, is an over-sized file the only thing that can cause $_FILES and $_POST to be empty?

Link to comment
https://forums.phpfreaks.com/topic/237646-how-on-earth/#findComment-1221186
Share on other sites

Just telling them that some data they supplied didn't work is a useless waste of bandwidth.

 

Well that will say that the file didn't upload. I am not sure if this is related, but apache processes the upload by putting it in the tmp folder, then php moves it to the proper location on the server for better accessibility via web browser.

Link to comment
https://forums.phpfreaks.com/topic/237646-how-on-earth/#findComment-1221202
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.