logo

Response

« Return to the main article

You are viewing this page out of context. To see it in the context it is intended please click here.

About This Page

Reply posted by S Hu on Thu 14 Feb 2008 in response to Controlling the Size of Uploaded Files

Re: To not save the doc...

Well, in a way I did...


What I do is this:
1. User creates a new doc and can upload up to 5 files.


2. In the WQS event, check if the total file size being submitted is over 10MB.


3. If the total file size is <10MB, then continue to save the doc (set
SaveOptions="1")


4. If the total file size is >=10MB, then do NOT save the doc (set
SaveOptions="0")


5. In my $$Return computed field, I have the following formula:


@If(SaveOptions="0"; "[/" + DbPath+"/FileSizeError?openform"+ "]";
"[/" + DbPath+"/0/"+@Text(@DocumentUniqueID)+"?EditDocument"+ "]")


6. In another computed field (I called it "SetHTTPHeader"), I have the
following formula:


@SetHTTPHeader("Expires"; 0)


Thus if the check returns false (exceeds 10MB total file size), then the doc
will not get saved and the FileSizeError page is returned.
On the FileSizeError page, I have a button "Go Back", with the code:


<a href="javascript: onClick=history.back(-1)">Go Back</a>


Voila! =)


Now, in testing this, it does work.... the only issue I am encountering is the
fact that on the server doc, the setting is set to 10MB, and my check in the
WQS agent checks for 10MB as well. But when I submit a file size greater than
10MB, it returns that ugly "Error 500 " page... which only means that the
server checks the file size of the request being submitted first before the WQS
is done?? Any idea why I'm getting this?