Jump to content

$_FILES['mypic']['size']


orange08

Recommended Posts

hi, i have a piece of code that using $_FILES['mypic']['size'] to check the selected file's size. this piece of code won't upload the file, just check the file size. but, it take quite long time to display the file size, so i just wonder whether

$_FILES['mypic']['size']

will causing the file being uploaded to my server for the file checking code to take effect?

Link to comment
https://forums.phpfreaks.com/topic/151881-_filesmypicsize/
Share on other sites

The file has to be uploaded to the server before any script on the server can do anything with it, including checking the size. That's what the POST form submission does

 

so, you meant that my files have been uploaded to the server? my purpose only want to check the file size, but has been uploaded the file. then, later PHPMAILER will upload again the file for email it...

that's meant have been double uploaded the file...and more time being taken for such process...

what i'm worrying is it will causing more space in my server has been utilized...not enough space for my website at the end...

 

if, i just need to check the total file size of the selected files before they are uploaded to the server, what can i do?

 

thanks!

Link to comment
https://forums.phpfreaks.com/topic/151881-_filesmypicsize/#findComment-797604
Share on other sites

PHP can't check the size of a file on your local machine because it can't access your local machine.

 

Rewrite your code so that it only uploads the file once, checks it's size... if it's too large, delete it and send a message back to the client saying so... if it's OK, then use it in your mail

Link to comment
https://forums.phpfreaks.com/topic/151881-_filesmypicsize/#findComment-797626
Share on other sites

PHP can't check the size of a file on your local machine because it can't access your local machine.

 

Rewrite your code so that it only uploads the file once, checks it's size... if it's too large, delete it and send a message back to the client saying so... if it's OK, then use it in your mail

 

for your information, the sending email task is carried out by phpmailer, so the upload is taken care by it. for your suggestion, i need to modify phpmailer code, but i'm new to php, so don't know how to handle it... :-[

Link to comment
https://forums.phpfreaks.com/topic/151881-_filesmypicsize/#findComment-797652
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.