#459242: Creeper documentation and code example : AWS tools and Drupal interactions made easy gives an example of creating a module that plugs the drupal authentication system on an Amazon SimpleDB domain. What about using this module with Amazon S3? Though on example page it is asserted it's easy, for non-coders it is actually difficult to figure out how to use Creeper module.

Would be very nice if the module contained ready to use UI to use with Amazon Web Services. Namely, I am struggling to get my filefield work with Amazon S3.

Comments

toemaz’s picture

Status: Active » Fixed

Implement hook_nodeapi()

  $bucket = YOUR_S3_BUCKET;
  
  if (isset($node->field_your_filefield[0]['source'])) {
    $s3 = new AmazonS3();

    $file = $s3->create_object($bucket, array(
      'filename' => $node->field_your_filefield[0]['filename'],
      'body' => file_get_contents($node->field_your_filefield[0]['filepath']),
      'contentType' => 'application/XXX',
      'acl' => S3_ACL_PUBLIC,
      'headers' => array('Content-Disposition' => 'attachment; filename="'.$node->field_your_filefield[0]['filename'].'"'),
    ));    
  }

This is just a quick write up how you can do it.
Having to code it up yourself instead of using a 'ready to use' module is much better since you have all the freedom to change the way objects are stored on S3. So don't expect to find or use a ready to use module.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.