Menu

Garbled files?

2001-07-23
2001-07-23
  • Matt A Gregory

    Matt A Gregory - 2001-07-23

    Just to make sure I have dotted my 'i's and crossed my 't's I'm posting here first.

    I've uploaded several jpeg files using marsh and for some reason they all come out garbled.  My usage should be pretty straight forward.  I'm uploading a single file in a multipart form.  Everything seems to work fine, but many of the bytes in the uploaded file were converted to ascii '?'.  My usage is pretty simple.  Once I get the input streem from the MultipartFileInfo.getFile("my_field_name") function I simply call the following loop:

        int x = _is.read();
        while(x >= 0) {
          _fw.write(x);
          x = _is.read();
        }

    This should be byte-in-byte-out read/write, so the two files should be identical.

    I have the two files and can send them if anyone wants to look at the hex.

    Thanks, -SL

     
    • Matt A Gregory

      Matt A Gregory - 2001-07-23

      oops, I meant to write MultipartFileInfo.getFile();  :)

       
    • Matt A Gregory

      Matt A Gregory - 2001-07-23

      Ok, so in desparation I write my own MultipartHttpServletRequest object and manually parse the request.

      Guess what.  The two uploaded jpegs (the garbled by Marsh and the one I parsed myself) are identical.  Both files contain the exact same errors.

      Does anyone have any clue why this could be happening?  Is it in the way I'm writing out the file?

       

Log in to post a comment.

MongoDB Logo MongoDB