Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Client error response [status code] 413 [reason phrase] Request Entity Too Large [url]

I am trying to upload a file to OpenStack's container.

I can upload small files to the container successfully but not able to upload large files like 1 MB or larger than 1 MB.

I am getting this error.

Client error response [status code] 413 [reason phrase] Request Entity Too Large [url]

Here is my code snippet

 <?php

require 'vendor/autoload.php';

use OpenCloud\OpenStack;
use OpenCloud\ObjectStore\Resource\DataObject;

global $client;

$client = new OpenStack('http://192.168.171.131:35357/v2.0/', array(
    'username' => 'admin',
    'password' => 'devstack',
    'tenantName' => 'admin'
        ));


$objectStoreService = $client->objectStoreService('swift', 'RegionOne', 'publicURL');

$container = $objectStoreService->getContainer('mani@ymail.com');
// Upload large object to the container.
$options = array(
    'name' => 'test.doc',
    'path' => 'uploads/test.doc'
);
$objectTransfer = $container->setupObjectTransfer($options);
$objectTransfer->upload();

If I replace 'path' => 'uploads/test.doc' with 'path' => getenv('uploads/test.doc')

I get You must provide either a readable path or a body.

I can easily upload the large files to my Server using PHP.

I can upload large files directly into container from OpenStack's Horizon Dashboard

Client error response [status code] 413 [reason phrase] Request Entity Too Large [url]

I am trying to upload a file to OpenStack's container.

I can upload small files to the container successfully but not able to upload large files like 1 MB or larger than 1 MB.

I am getting this error.

Client error response [status code] 413 [reason phrase] Request Entity Too Large [url]

Here is my code snippet

 <?php

require 'vendor/autoload.php';

use OpenCloud\OpenStack;
use OpenCloud\ObjectStore\Resource\DataObject;

global $client;

$client = new OpenStack('http://192.168.171.131:35357/v2.0/', array(
    'username' => 'admin',
    'password' => 'devstack',
    'tenantName' => 'admin'
        ));


$objectStoreService = $client->objectStoreService('swift', 'RegionOne', 'publicURL');

$container = $objectStoreService->getContainer('mani@ymail.com');
// Upload large object to the container.
$options = array(
    'name' => 'test.doc',
    'path' => 'uploads/test.doc'
);
$objectTransfer = $container->setupObjectTransfer($options);
$objectTransfer->upload();

If I replace 'path' => 'uploads/test.doc' with 'path' => getenv('uploads/test.doc')

I get You must provide either a readable path or a body.

I can easily upload the large files to my Server using PHP.

I can upload large files directly into container from OpenStack's Horizon Dashboard