Closed loicmitton closed 4 years ago
Hello,
I'm trying to create a php script that will be called from javascript to get a temp url to upload file.
I have this code :
$container->saveMetadata(array( 'Access-Control-Allow-Origin' => '', 'X-Container-Meta-Access-Control-Allow-Origin' => '' )); $filename = com_create_guid(); //echo $filename; $object = $container->dataObject(); $object ->saveMetadata(array( 'Access-Control-Allow-Origin' => '*', 'Access-Control-Expose-Headers' => 'Access-Control-Allow-Origin' )); $object->setName($filename); //probably a GUID $url = $object->getTemporaryUrl(3000, "PUT");
However if I try to call the temporary url to upload the file, I get a 401 response code and OPTION on the temp url don't display the access-control-allow-origin.
Container header was wrongly set.
Hello,
I'm trying to create a php script that will be called from javascript to get a temp url to upload file.
I have this code :
$container->saveMetadata(array( 'Access-Control-Allow-Origin' => '', 'X-Container-Meta-Access-Control-Allow-Origin' => '' )); $filename = com_create_guid(); //echo $filename; $object = $container->dataObject(); $object ->saveMetadata(array( 'Access-Control-Allow-Origin' => '*', 'Access-Control-Expose-Headers' => 'Access-Control-Allow-Origin' )); $object->setName($filename); //probably a GUID $url = $object->getTemporaryUrl(3000, "PUT");
However if I try to call the temporary url to upload the file, I get a 401 response code and OPTION on the temp url don't display the access-control-allow-origin.