Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

Error while uploading css files to shared entity.

digitalr3317510
Level 2
Level 2

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.

1 Accepted Solution
mikecyang
Correct answer by
Employee
Employee

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

View solution in original post

1 Reply
mikecyang
Correct answer by
Employee
Employee

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

View solution in original post