Uploaded image for project: 'Apache Cordova'
  1. Apache Cordova
  2. CB-11316

Content-Type not set for multi-part file

    XMLWordPrintableJSON

Details

    Description

      When uploading a file as a muti-part file on windows 10 the "Content-Type" header for the file is not set.

      This results in a request that has no content-type that reflects the type of the file.

      This can be resolved by setting a multi-part header after creating the
      BackgroundTransferContentPart

      Link to GitHub file

      by changing the following code:

      var fileToUploadPart = new Windows.Networking.BackgroundTransfer.BackgroundTransferContentPart(fileKey, fileName);
      fileToUploadPart.setFile(storageFile);
      transferParts.push(fileToUploadPart);
      

      To:

      var fileToUploadPart = new Windows.Networking.BackgroundTransfer.BackgroundTransferContentPart(fileKey, fileName);
      
      // added the file mime type
      fileToUploadPart.setHeader("Content-Type", mimeType);
      
      fileToUploadPart.setFile(storageFile);
      transferParts.push(fileToUploadPart);
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ben3005 Ben Marshall
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: