jaiminrajani Posted December 12, 2009 Share Posted December 12, 2009 I have a contact form in my website with the option to attach a file. I want to set the attachment limit as 10mb. But currently, after attaching a file to the contact form and clicking on 'submit', after the message is sent, the following error message is shown: Warning: filesize() [function.filesize]: stat failed for 0 in /webcorp1/www/corpusers/j/a/jaimin.me/contact-form/contact-form/contact-form.php on line 127 The line 127 of my form is as follows: filesize($_FILES[$i]['tmp_name']/1024) <= $x['maxsize']) I would appreciate if anyone could help me out get rid of this error message and tell me how to set my attachment limit to 10mb. Thank You. Jaimin Rajani [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/184860-php-contact-form-filesize-functionfilesize-error/ Share on other sites More sharing options...
dawsba Posted December 12, 2009 Share Posted December 12, 2009 1024 means 1024kb change to 10240 u might need to alter .htaccess depending on ur hosting Quote Link to comment https://forums.phpfreaks.com/topic/184860-php-contact-form-filesize-functionfilesize-error/#findComment-975812 Share on other sites More sharing options...
rajivgonsalves Posted December 12, 2009 Share Posted December 12, 2009 post some more of your code filesize($_FILES[$i]['tmp_name']/1024) <= $x['maxsize']) your putting the 1024 inside the filesize function it should be outside ? Quote Link to comment https://forums.phpfreaks.com/topic/184860-php-contact-form-filesize-functionfilesize-error/#findComment-975813 Share on other sites More sharing options...
jaiminrajani Posted December 12, 2009 Author Share Posted December 12, 2009 @dawsba Thanks a lot for such a quick reply. I have changed it to 10240. But let me bring in notice to you that before I added '/1024' to line 127, my contact form didn't show this error message. Quote Link to comment https://forums.phpfreaks.com/topic/184860-php-contact-form-filesize-functionfilesize-error/#findComment-975814 Share on other sites More sharing options...
jaiminrajani Posted December 12, 2009 Author Share Posted December 12, 2009 @rajivgonsalves Thank you for replying. I am an amateur. So I didn't get a single thing that you've suggested. Please make the changes in the line 127 and send the corrected one. Thanks a lot again. Quote Link to comment https://forums.phpfreaks.com/topic/184860-php-contact-form-filesize-functionfilesize-error/#findComment-975815 Share on other sites More sharing options...
rajivgonsalves Posted December 12, 2009 Share Posted December 12, 2009 if you post some more of your code around that line it will be helpful cannot help with just a line Quote Link to comment https://forums.phpfreaks.com/topic/184860-php-contact-form-filesize-functionfilesize-error/#findComment-975816 Share on other sites More sharing options...
jaiminrajani Posted December 12, 2009 Author Share Posted December 12, 2009 Also let me tell you that though the error message is being shown, I am still receiving the message along with the attachment successfully in my mailbox. Weird :\ Quote Link to comment https://forums.phpfreaks.com/topic/184860-php-contact-form-filesize-functionfilesize-error/#findComment-975819 Share on other sites More sharing options...
jaiminrajani Posted December 12, 2009 Author Share Posted December 12, 2009 I have attached my contact-form.php file here. Please make the necessary changes. [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/184860-php-contact-form-filesize-functionfilesize-error/#findComment-975821 Share on other sites More sharing options...
rajivgonsalves Posted December 12, 2009 Share Posted December 12, 2009 the line should have been filesize($_FILES[$i]['tmp_name'])/1024 <= $x['maxsize']) Quote Link to comment https://forums.phpfreaks.com/topic/184860-php-contact-form-filesize-functionfilesize-error/#findComment-975823 Share on other sites More sharing options...
jaiminrajani Posted December 12, 2009 Author Share Posted December 12, 2009 @rajivgonsalves Brilliant. Hats off to you. You've olved my problem ! Thanks you a zillion times. Would like to get in touch with you. Please visit my site http://jaimin.me/ Quote Link to comment https://forums.phpfreaks.com/topic/184860-php-contact-form-filesize-functionfilesize-error/#findComment-975824 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.