I want to give my users possibility to upload files directly to my cloud on OpenStack using temp url's and HTML POST form.
In openstack docs they have:
Upload objects directly to the Object Storage system from a browser by using form POST middleware
But i don't know how to build correct HTML form? Any one have a example how to do it in PHP? Below my code:
$client = new OpenStack('https://auth.cloud.ovh.net/v2.0/', array(
'username' => 'xxxxx',
'password' => 'xxxxx',
'tenantId' => 'xxxxx'
));
$objectStoreService = $client->objectStoreService('swift', 'SBG1');
$container = $objectStoreService->getContainer("XXXXX");
$object = $container->dataObject();
$object->setName("test");
$expire = 60*10;
$tempUrl = $object->getTemporaryUrl($expire, "PUT");
return $this->render("CloudUpload:Main:index.html.twig", array("url" => $tempUrl));
OpenStack class from Rackspace github
{% block body %}
<form method="POST" action="{{ url }}" enctype="multipart/form-data">
<input type="file" name="file">
<button name="submit" type="submit">Send</button>
</form>
{% endblock %}
Response from cloud if I send this request is:
400 Bad Request
FormPost: Max File Count Exceeded
edit: Maybe create AJAX request with this data will be solution?