Re: [gmime-devel] GMime - parse MIME created by web browser during file upload?



Hi Caroline,

Yes, gmime can be used to parse these streams.

You will need to make sure that the stream includes the Content-Type header that defines the boundary marker, though.

Hope that helps,

Jeff

On 7/22/2018 1:08 PM, Caroline Beltran via gmime-devel-list wrote:
I would like to know if GMime can be used to parse the MIME created by a web browser when a user uploads a binary file such as a jpg.  Here is an example of this MIME format:

------WebKitFormBoundaryFuv4ThyECHCwguJb

Content-Disposition: form-data; name="fileToUpload"; filename="gordo 2.jpg"

Content-Type: image/jpeg



***JPEG*BINARY*DATA*GOES*HERE***MADE*UP*OF*MOSTLY*NON-PRINTABLE*CHARACTERS

------WebKitFormBoundaryFuv4ThyECHCwguJb

Content-Disposition: form-data; name="submit"



Upload Image

------WebKitFormBoundaryFuv4ThyECHCwguJb--

The binary will obviously contain non-printable characters since it is an exact copy of the binary that makes up the original JPG file upload.

This is the data from the MIME above that I am interested in:

  • Content-Type
  • filename
  • binary

Please note that different web browsers create different 'boundaries'. The boundary has random numbers appended to the end of it created with each file upload.

Can GMime be used to parse out the fields above?  Thank you!




_______________________________________________
gmime-devel-list mailing list
gmime-devel-list gnome org
https://mail.gnome.org/mailman/listinfo/gmime-devel-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]