CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 File upload with custom error message when size exceeded

Print topic Send  topic

Author Message
karen

Posts: 99
Posted: 10/06/2010, 6:27 PM

Hi all,

I'm trying to display a friendlier error message for a file upload component but not for all file upload components in the project so editing the language file is not the option.

I added code to the OnValidate event of the file upload component and to test it, I've just used a static value for the filesizelimit, some small value like 100 which is smaller than the FileSizeLimit set for the component.

On testing it, if I upload a file that is in between those 2 values, i.e., exceeds 100 but not component FileSizeLimit, my OnValidate code is triggered. However, if I upload a file that exceeds the component FileSizeLimit, the standard error is triggered and that seems to overwrite my custom error. Perhaps it returns the error even before it reaches my code? It would be really helpful if someone could explain the sequence of events on how the standard file upload FileSizeLimit works so that I can intervene it to add my own custom error.

I hope someone can help or can suggest a better way to do this. I've also tried putting my code in the BeforeProcessFile event with the same results.

Thanks everyone in advance for any advice.

Cheers,
Karen
View profile  Send private message
datadoit
Posted: 10/07/2010, 5:40 AM

Two things to try.... Set the component's File Size Limit to blank,
null, or zero. Or, set the component's File Size Limit to something
astronimical, like ten million trillion gozillion terabytes.
karen

Posts: 99
Posted: 10/07/2010, 3:43 PM

Thanks for your idea, datadoit. I've thought about that as a workaround but then I thought there should be a proper way to do this so am checking with all the experts here. If there's no other way, I'll use that workaround. Thanks again!
View profile  Send private message
dormata

Posts: 1
Posted: 12/21/2010, 5:32 AM

When a file exceeds upload limit, the application isn't notified because IIS aborts the request. Thus the error must be handled on client. See:
http://it.expertmonster.com/question/File-upload-size-l...ceptio-114.html
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.