file upload verification

Discussion in 'ASP .Net' started by Guest, Apr 17, 2005.

  1. Guest

    Guest Guest

    I asked this question a few days ago, but got no answer.
    As it's very important to me, I'm asking again:
    How do I write - in an application that uploads a file - code that makes
    sure that once a user has started to upload a file, it will continue
    uploading till the end, no matter what?
    Thank you
    Lea
     
    Guest, Apr 17, 2005
    #1
    1. Advertisements

  2. Guest

    Lucas Tam Guest

    You don't.

    Sorry - you're going to have to build in some safety mechanism (i.e. file
    integrity checks, checksums, etc.
     
    Lucas Tam, Apr 17, 2005
    #2
    1. Advertisements

  3. Guest

    Mark Rae Guest

    "No matter what" could mean anything. Do you mean e.g. that once a user has
    started to upload a file, you want to prevent them from pulling the plug out
    of their PC until the file has been completely uploaded? What if there's a
    power cut? What if your server goes down in the middle of the transfer?

    That said, you could check the length of the file before and after
    posting...On the assumption that your using an HtmlInputFile control for
    this, it will have a PostedFile.ContentLength property which you could write
    away to a database against the PostedFile.FileName property. Then, once
    you'd kicked off the upload with the PostedFile.SaveAs method, you could
    interrogate the copy of the file on the server and verify that the length
    was the same...
     
    Mark Rae, Apr 17, 2005
    #3
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.