how to upload file by the ceph S3 php api

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 To whom it may concern:
    I run ceph radosgw as s3 service,  and the AWS SDK for PHP  suport upload file for browser. the class is s3BrowserUpload , how the ceph s3 api use s3BrowserUpload class, and the ceph s3 api support upload file;

the AWS example

<?php
require_once 'sdk.class.php';
require_once 'extensions/s3browserupload.class.php';

$upload = new S3BrowserUpload();

// Generate the parameters for the upload.
$html_parameters = $upload->generate_upload_parameters('my-upload-bucket', '15 minutes', array(

    // Set permissions to private.
    'acl' => AmazonS3::ACL_PRIVATE,

    // Set various HTTP headers on the uploaded file.
    'Content-Disposition' => 'attachment; filename=information.txt',
    'Content-Encoding' => 'gzip',
    'Content-Type' => '^text/',
    'Expires' => gmdate(DATE_RFC1123, strtotime('January 1, 1970, midnight GMT')), // Format for the HTTP Expires header

    // The S3 Key to upload to. ${filename} is an S3 variable that equals the name of the file being uploaded.
    // We're also using PHP's built-in Filter extension in this example.
    'key' => '^user/' . filter_var($_POST['user_id'], FILTER_VALIDATE_INT) . '/${filename}',

    // Where should S3 redirect to after the upload completes? The current page.
    'success_action_redirect' => S3BrowserUpload::current_uri(),

    // Status code to send back on success. This is primarily to work around issues in Adobe® Flash®.
    'success_action_status' => 201,

    // Use reduced redundancy storage.
    'x-amz-storage-class' => AmazonS3::STORAGE_REDUCED
));
?>

<form action=""
      method="<?= $html_parameters['form']['method'] ?>"
      enctype="<?= $html_parameters['form']['enctype'] ?>">

    <? foreach ($html_parameters['inputs'] as $name => $value): ?>
    <input type="hidden" name="<?= $name; ?>" value="<?= $value; ?>">
    <? endforeach; ?>

    <input type="file" name="file">
    <input type="submit" name="upload" value="Upload">
</form>









_______________________________________________
ceph-users mailing list
ceph-users@xxxxxxxxxxxxxx
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com

[Index of Archives]     [Information on CEPH]     [Linux Filesystem Development]     [Ceph Development]     [Ceph Large]     [Ceph Dev]     [Linux USB Development]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [xfs]


  Powered by Linux