This topic is locked
[SOLVED]

 Upload Size

4/17/2013 11:12:29 AM
ASPRunnerPro General questions
B
brasil2011 author

I'm trying to check the file size.

I need to inform the user that the maximum file size is 1 MB.

I changed the server value to 1MB.

If larger than 1MB I will send message: "File too large"

I put the code () in the event "Before record add"

But when the file is larger than 1MB, I get the first message from the server (), the event not starts.

I use ASPRUNNER 6.3. Can anyone help me?
Name of my field : nome_arquivo
()------------------ code----------------------------------------------

mysize=lenb(GetUploadedFileContents("value_nomearquivo" & postvalue("id")))

if mysize > 1000000 then ' if file size is greater than 1Mb

message = "File too large."

BeforeAdd=false

exit function

else

BeforeAdd=true

end if
(
)
----------------------------------------

Request object error 'ASP 0104 : 80004005'

Operation not Allowed

/sistema/include/aspfunctions.asp, line 1827

Sergey Kornilov admin 4/17/2013

Make sure that your web server doesn't limit upload file size.
Check this article for some advise:

http://webcheatsheet.com/asp/asp_troubleshooting.php#iis7

B
brasil2011 author 4/17/2013



Make sure that your web server doesn't limit upload file size.
Check this article for some advise:

http://webcheatsheet.com/asp/asp_troubleshooting.php#iis7


Thank you! but...

My server limit upload file size 1MB.

The problem is not this.

What I do not understand is why the event "Before record added" is not call for files larger than 1MB.

For files smaller than 1MB, the event is call.

I do not have to send my message before the server message?

I need to inform the user that the file can have only 1MB, when he tries to upload more than 1MB.

Sergey Kornilov admin 4/17/2013

You cannot tell user anything before file is uploaded. BeforeAdd event will be only executed is file is uploaded to sucessfully.
You need to increase server upload file size limit to 10Mb or to 100Mb.

B
brasil2011 author 4/17/2013



You cannot tell user anything before file is uploaded. BeforeAdd event will be only executed is file is uploaded to sucessfully.
You need to increase server upload file size limit to 10Mb or to 100Mb.


Ok :-(

thank you very much!

B
brasil2011 author 4/17/2013



You cannot tell user anything before file is uploaded. BeforeAdd event will be only executed is file is uploaded to sucessfully.
You need to increase server upload file size limit to 10Mb or to 100Mb.


Please when I will used this code?
mysize=lenb(GetUploadedFileContents("value_nomearquivo" & postvalue("id")))

if mysize > 1000000 then ' if file size is greater than 1Mb

message = "File too big"

BeforeAdd=false

exit function

else

BeforeAdd=true

end if