Error while uploading css files to shared entity.

digitalr3317510

21-10-2015

Checked the functionality for shared content. Created one sharedContent entity and uploaded two js files in that. But facing problem for files with other mimetypes like images, css etc. Its throwing error "Bad mimetype found. Asset declared to be of mimetype application/javascript, but was found to be image/png".

Checked the function uploadSharedContent in file /class/sharedEntity.php and found the following piece of code which is declaring mime type:

$headers = $this->_setHeaders($this->mimetypes['json'], $this->mimetypes['js'], $this->parameters['client_upload_id']);

I have followed the syntaxes in the API documentations and also from the example in the PHP example package /sharedContent/create_shared_entity.php

Can you please let me know if I am missing anything for uploading the css/images to shared entity.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

mikecyang

Employee

22-10-2015

Hi,

Please update the line that you pointed out (file /class/sharedEntity.php line #70) to as follows:

$headers = $this->_setHeaders($this->mimetypes['json'], null, $this->parameters['client_upload_id']);


Also, in the demo script (file /sharedContent/create_shared_entity.php starting line #49), please make sure that it matches the following:

// request & store the latest content URL

$sharedContentObj->getMetadata()->printCurlData();

// request for the sharedContent manifest

$sharedContentObj->getManifest()->printCurlData();


The above fix will be available in the upcoming release.

- Mike

Answers (0)