Another File Upload question

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi there,
I've been reading all I could find on the control 'input type=file' and all
the trouble that it comes when uploading large binary files (>4MB) to a DB
server or server path.

I've seen plenty of examples about it, and they all agree that to make
possible the upload of those files, it's mandatory to change the web.config
(or machine.config) for the maxRequestLength attribute of the <httpRuntime>
element.

What I'd need though, is a way for NOT allowing content larger than those
4MB to be uploaded. I've tryed the following on my code, but it's not
working (probably because I've also read that when submitting the webform,
the content is already sent to the server, thus if you send 50MB you'll have
to wait until the server returns an error)

if( FileInputAttachment.PostedFile.ContentLength ) > 1024
{
//change a label text to display an error
}

Is there a way of querying for the PostedFile.ContentLength BEFORE posting
the data to the server? This way I could warn the users not to upload files
larger than a MB or so...

Thanks!!


.



Relevant Pages

  • Re: File Upload - Security Issues
    ... You want to upload a file for what reason and ... these viruses have less chance of being able to execute (even if succeeded ... :> file and what pitfalls you see re: security might be helpful on this ... :>: files to an IIS server that doesn't have MS Office actually installed? ...
    (microsoft.public.scripting.vbscript)
  • Re: File Upload - Security Issues
    ... uploaded and the user could upload any or all of these in theory. ... There is no one product that can give you 100% security, ... > Code doesn't execute in local memory space unless remote user has rights ... > You don't have MS Office installed on the server. ...
    (microsoft.public.scripting.vbscript)
  • pure-ftp nologin
    ... I have a server running FreeBSD 6.3. ... # If you want to enable PAM authentication, ... AnonymousCanCreateDirs no ... # Disallow anonymous users to upload new files ...
    (comp.unix.bsd.freebsd.misc)
  • [NT] DeskNow Mail and Collaboration Server Directory Traversal Vulnerabilities
    ... The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com ... Collaboration Server is "a full-featured and integrated mail and instant ... attachment upload feature that may be exploited to upload files to ... * DeskNow Mail and Collaboration Server version 2.5.12 and prior ...
    (Securiteam)
  • Re: [Full-disclosure] phpBB 2.0.17 (and other BB systems as well) Cookie disclosure exploit.
    ... app that allows the user to upload an image of some type. ... Internet Explorer ignores the content type sent by the web server and ... > HTML code instead. ... > upload it as a phpBB avatar. ...
    (Full-Disclosure)