error messages when php size limites are reached
Posted: 05 October 2010 12:15 AM   [ Ignore ]
Has a Great Personality
Rank
Total Posts:  36
Joined  2010-09-08

This may not be a question about Safecracker as much as it is about ExpressionEngine, but I’m wondering if there is a way for a Safecracker form to give error messages if the php values for post_max_size or upload_max_filesize are exceeded?  Right now, I have a form where users are submitting some pretty large files.  I have the post_max_size set to 30M and the upload_max_filesize set to 15M (there are two upload file fields on the form).  If the user attempts to submit a form with files that exceed these limits, it just reloads the form page, with all the previously entered information removed.  It doesn’t give any sort of error message or clue that the form wasn’t uploaded.  Is it possible to have an error message for these types of errors?

Thanks for your help!

Profile
 
 
Posted: 05 October 2010 01:59 AM   [ Ignore ]   [ # 1 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Did you set up a max filesize in your EE file upload preferences?

Profile
 
 
Posted: 05 October 2010 07:50 PM   [ Ignore ]   [ # 2 ]
Has a Great Personality
Rank
Total Posts:  36
Joined  2010-09-08

Ah…I forgot to go back and set that after I changed the php value.  I just went in a set that value, but now it’s still not spitting out an error message.

I have two safecracker file fields on this form.  Both are going into the same file upload directory and I have the maximum file size set to 15MB in the EE control panel and in the php value.  I just tried to submit a form with a 21MB file in one of the file fields and a 4MB file in one of the other file fields.  The form actually submitted and brought up the success message, but when I go into the folder where the files are being dumped, the only file there is the 4MB file.  So it’s acting like it’s taking both files, but it’s not taking the large file and it’s not giving an error message.  Any idea of what I can do to make sure the form won’t submit if the file is too large and bring up an error message?

Profile
 
 
Posted: 06 October 2010 09:27 PM   [ Ignore ]   [ # 3 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Can you download the latest build of SafeCracker if you haven’t already, and see if it gives you an error message now.

Profile
 
 
Posted: 06 October 2010 09:32 PM   [ Ignore ]   [ # 4 ]
Has a Great Personality
Rank
Total Posts:  36
Joined  2010-09-08

Hi Rob,

I’m running build 20100924 which looks like the latest version on the release notes.

Profile
 
 
Posted: 06 October 2010 09:36 PM   [ Ignore ]   [ # 5 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Gotcha. The reason I asked is because I just tried uploading a file that was too big in a SafeCracker form and got a big fat error message, so I’m not sure why you didn’t.

Profile
 
 
Posted: 06 October 2010 09:47 PM   [ Ignore ]   [ # 6 ]
Has a Great Personality
Rank
Total Posts:  36
Joined  2010-09-08

Hmmm…that’s odd.  I’ve tried to work with all sorts of combinations of files and it’s still not spitting out an error message.  If the file is too large it’s actually removing the content from that field and submitting the form without it.  To check this I made one of the file fields required and tried to upload a file in that field that was larger than the permitted size.  Instead of an error message about the file being too large, I just get the error message that the field is required.  So it’s seeing that the file is too large but then it’s just removing the contents of that field.

One idea - I noticed on the image above of the error message you’re getting that it says “Image” before the message.  Is the file upload location you’re uploading the file to set to only allow for images?  I’m uploading to a location that allows all file types.  Do you think that would matter?

Profile
 
 
Posted: 06 October 2010 09:49 PM   [ Ignore ]   [ # 7 ]
Teen Scream
Avatar
RankRankRank
Total Posts:  3541
Joined  2009-05-29

Is your file field a cell within a Matrix? Or a field itself?

Image (in my screenshot) is the name of my field.

Profile
 
 
Posted: 06 October 2010 09:53 PM   [ Ignore ]   [ # 8 ]
Has a Great Personality
Rank
Total Posts:  36
Joined  2010-09-08

Oh right…it’s the name of the field.  Ignore that idea then.

My field is just a safecracker file field on it’s own.  It’s not within a Matrix field or anything else.

Profile