Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.
  1. A word document which could be opened properly. (not corrupted)

  2. File is uploaded using a web browser on Windows from a USB Drive

    <input id="uFile" type="file" multiple="multiple" name="uFile" size="43">

  3. The file uploaded and the file in the USB Drive is corrupted.

Do you know the reason behind?

I think that uploading a file in the web would not change its content. Am I correct? Or would it be computer virus?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

You are definitely correct in that the file should not be altered by an upload. A few things to check:

  1. Make sure your "<form>" stanza that contains your file upload "<input>" tag includes the following value: enctype=multipart/form-data

  2. Check that your file upload handling code is reading data as 8-bit binary.

  3. Check that your file upload handling code is writing data as 8-bit binary.

Additionally, it is possible that a virus might be interfering with uploads (as you suspected), or even certain anti-virus programs (although this is rare). Make sure your anti-virus software is up-to-date, and use a good anti-SpyWare program like MalwareBytes to scan for SpyWare.

share|improve this answer
    
Thank you for your quick reply! The multipart/form-data certainly solves the problem of corrupted file in the server for many :) As to explain to stakeholders, I have to prove that file would not be altered by upload. I have search the web for reference but sadly could not find any :( Another problem is that the file at the client (USB) is also corrupted after uploading the file to the web server. I guess that is caused by unsafe removal of USB disk. –  Seubei May 12 '11 at 8:04
    
@Seubei: You're welcome. The source file is corrupted?!? Then the most likely suspects are a defective USB memory stick (try the same with a file from your local hard drive, and if it doesn't get corrupted by uploading then the USB stick is the problem), or something like an actively running virus that's corrupting files (viruses are often malicious by design, after all). –  Randolf Richardson May 12 '11 at 15:35
    
Thank you for your suggestions! Anyway, the file doesn't get corrupted when the original file is written to the USB again. –  Seubei May 16 '11 at 2:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.