Cordova File Transfer remove Multipart or Content-Disposition Header

前端 未结 4 750
暖寄归人
暖寄归人 2020-12-21 11:34

I managed to upload an image to my server using Cordova File Transfer plugin.

var img = 
var url = 

var o         


        
4条回答
  •  温柔的废话
    2020-12-21 12:04

    Took me awhile to figure this but this is the way I removed the Multipart Header. Here's the solution/work around.

    Open: \platforms\android\src\org\apache\cordova\filetransfer\FileTransfer.java

    Look for:

    sendStream.write(beforeDataBytes);
    totalBytes += beforeDataBytes.length;
    

    Comment away or delete these 2 lines. They are the code that adds the multipart header.

    Also remove:

    sendStream.write(tailParamsBytes);
    totalBytes += tailParamsBytes.length;
    

    This code adds a tail for the multipart header.

    I have done a MD5 checksum check and they are of the same now.

提交回复
热议问题