orange08 Posted March 31, 2009 Share Posted March 31, 2009 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 More sharing options...
Mark Baker Posted March 31, 2009 Share Posted March 31, 2009 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 Link to comment https://forums.phpfreaks.com/topic/151881-_filesmypicsize/#findComment-797592 Share on other sites More sharing options...
orange08 Posted March 31, 2009 Author Share Posted March 31, 2009 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 More sharing options...
Mark Baker Posted March 31, 2009 Share Posted March 31, 2009 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 More sharing options...
orange08 Posted March 31, 2009 Author Share Posted March 31, 2009 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.