0

I'm getting this error while uploading files having size > 4MB. My web app is deployed on IIS7.

This size limit it's ok for me, but I'd like to avoid the error when someone try to upload larger files. Is it possible to just show a warning message in the uploading page? What should I do?

NOTE I want to prevent user to upload files larger than 4MB, so I don't want to increase the size limit. I just want to avoid the error to be shown to user.

davioooh
  • 23,742
  • 39
  • 159
  • 250
  • Probably, but at the level of detail you provide, why should I bother guessing? – spender Sep 05 '13 at 16:07
  • 2
    @spender well, I don't know... if you aren't interested just ignore me... ;) – davioooh Sep 05 '13 at 16:09
  • Some detail of your uploading page and method might be appropriate. HTML5 offers new stuff, but we don't know exactly what you're doing. – spender Sep 05 '13 at 16:10
  • @davioooh Check for `FileInfo.Lenghth` of the file. It returns the size in bytes (not the size on disk though) which I think is what you're looking for. – Arian Motamedi Sep 05 '13 at 16:19
  • 1
    Why make the user go through the entire upload process just to tell him/her the file is too large? – Garrison Neely Sep 05 '13 at 16:21

1 Answers1

1

Checking it client-side before you upload it is a safe way of doing it. I've used PlUpload in the past with great success.

http://plupload.com/

Garrison Neely
  • 3,238
  • 3
  • 27
  • 39
  • 1
    +1. Although I'd suggest that checking it client-side is the **only** responsible way of doing it. Letting a user wait until it's already been uploaded would be maddening. – NotMe Sep 05 '13 at 16:57
  • Yep. Anyone that's ever been on a slow connection (or 56k!) knows how infuriating it can be to spend the time uploading something only to have it check server-side that something's not right and get a "sorry, try again!" message. – Garrison Neely Sep 05 '13 at 16:58
  • @GarrisonNeely ok, I'll go for a client side check, but I think I'm going to use a simple jQuery script instead of a plug-in. Thank you! – davioooh Sep 06 '13 at 08:06