Question

alter file content type in httpmultipartuploader (fme 2104 sp1)

  • 13 January 2015
  • 2 replies
  • 2 views

Badge +4
Hello,

 

 

(i'm running Fme2014 sp1 - and looking for an answer within this release)

 

 

I'm posting data via http to a remote service api that requires a multipart stream consisting of a image (photo) and 4 parameters (metadata against the photo, description,title etc)

 

 

the problem I have is that the receiving service checks the file type to ensure it's of a type begining with 'image/*' (where * could be any of the image types), however for some reason the httpmultipartuploader is passing the image as 'application/octet-stream'.

 

 

Is there any way to force the transformer to use a different type?

 

 

or failing that can any one suggest another method of acheiving the same thing?

 

 

thanks for any help in advance....

 

 

Nick

2 replies

Userlevel 4
Hi,

 

 

have you tried to add something like

 

 

    Content-Type: image/jpg

 

 

to the HTTP request headers in the HTTPMultipartUploader?

 

 

David
Badge +4
Hi David,  Thanks for your response.

 

 

I think the mimetype is being read from one of the parts of the multipart stream, not from the post header unfortunetely. (here's what it looks like (http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4))

 

 

It seems the HttpMultipartUploader sets the files to a content-type:Application/octetstream by default?

 

 

The main header needs to be set to Content-Type:mutipart/form-data for it to work.

 

 

Maybe this is a enhancment request, to enable setting content type of files being uploaded.

 

 

I had a go at creating a form-data body (setting boundaries etc) then using the httpuploader to send the files insted, however not quite sure what i'm doing and the post doesn't seem to be parsed correctly by the recieving code (although it does recognise it as a multi-form stream).

Reply