Support

REST API Attachment File upload incorrect MIME type

  • 1.  REST API Attachment File upload incorrect MIME type

    Posted 04-03-2019 02:42
    Hello,

    I am running into an issue when using the REST API to upload an attachment to my JAMA server, it uploads it as the incorrect MIME type. In the PHP code executed, it is indeed set as "image/png", but when it is uploaded to JAMA it changes it to "application/octet-stream".

    If I upload the exact same image through the web interface, it keeps the correct "image/png" association, it is only with the JAMA API. Any ideas on how I could possibly fix this?

    I also used the CurlFile to generate the request, which has the correctly identified MIME type. 
    $data = array('file' => curl_file_create(@dirname(__FILE__) . '/uploadImage.png', 'image/png', 'uploadImage.png'));
    Below I have attached another thread that came to the conclusion that I am at now.

    https://community.jamasoftware.com/communities/community-home/digestviewer/viewthread?GroupId=13&MID=1785&CommunityKey=6c432c09-9859-4cd3-8d2c-ea0a02a8a43d&tab=digestviewer

    ------------------------------
    Alexander Sigler
    ------------------------------