HI guys,

Attached is a patch for the file module for Drupal eCommerce 5.x-3.x which does the following:

(a) allows the site admin to switch between delivering download files from the server the Drupal site is hosted on, or Amazon S3 simple storage services

(b) Allows the site admin to specify a simple file download expiry time..from 30 minutes to 3 days in steps of 12 hours.

Notes:

  1. It was adapted in this way for a specific project and I'm submitting this in case it is of use for others. The application involved the sale of very large file downloads (from 30mb to 750mb) and when the economics were worked out, it was far more efficient to use amazon s3 simple storage services to deliver the huge downloads, rather than invest in an expensive hosting solution. Downloads from amazon s3 are very swift and relatively inexpensive by amazons rate card.
  2. The way the Amazon s3 integration works is that you use the normal file path to test out your shop (with small dummy .zip files, for example) and then onece it's all done and dusted, you upload the correct files (with the same filenames as the dummy .zip files) up to your amazon s3 bucket using something like S3FOX. Then you just activate the Amazon S3 override, enter in your access code + secret access key + bucket name and away you go. The Amazon s3 function generates an expiring link that lasts for an hour, but, the file download link respects the expiry date set on the settings page.

    I thought about integrating an upload direct to Amazon s3 through the file.module, but, I concluded that would be a waste of time (and code) and resources for a task that would only be carried out once in a while and it's much easier to simply press ALt-TAB and open up S3FOX.

  3. The amazon s3 link generated by the module lasts for 1 hour. Which means a download link maybe available for 3 days, but, the link to download the file from amazon s3 is only available for 1 hour. That was requested as an added security thing by the client.

    I haven't added in an option to change that on the settings page, but if you do want to change it, you can find it on line 669

    $expiry = time() + 3600; //link will work for 1 hour after this page is generated.

    3600 seconds = 1 hour.

  4. attached is hmac.php.txt which is required by the ec_file_transfer function when generating the amazon s3 link. Rename it to hmac.php and place it in the same folder as your file.module.
  5. The following lines are commented out because my modified file.module also allowed for file subproducts...i.e. the client wanted to sell album music download in different formats..i.e.

    MP3 128kbps
    MP3 320kbps
    WAV (exact CD copy)
    AIFF (exact CD copy)

        //case 'subproduct_types':
        //  return array('file');
    
        //case 'cart add item':
        //  return subproducts_cart_set_subproduct_variation($node, $a3);
    

    If you want file subproducts in your shop, you need to apply the Patch for file subproducts and uncomment those lines in the file.module.

  6. I have also attached a patched version of the module called patchedfilemodule.txt for those not familiar with patching. rename it to file.module and upload it into your ecommerce/file folder

hope that's of use to others. I'm non-plussed with whether it's comitted or not, I'll leave that up to the community to review the patch (it maybe done in a better way) and decide. As soon as the shiny new and very exciting Drupal eCommerce API version 4 is sorted with file products, I'll be shifting to that straight away.

Dub

Comments

Sankar-2’s picture

Title: Amazon S3 simple storage services integration and simple file download product expiry time setting » Amazon S3 simple storage services integration and simple file download product from drupal
Project: e-Commerce » Drupal core
Version: 5.x-3.6 » 6.x-dev
Component: file » drupal.module
Assigned: Unassigned » Sankar-2

Hi All,

I have one problem , how to use amazon s3 with drupal6 and how to configure and how to download the product in amazon s3 with drupal. please kindly reply this.

Dublin Drupaller’s picture

Hi Sankar,

The patch I posted above is for Drupal ecommerce version 3.x which works with Drupal 5.x. The new version of Drupal eCommerce 4.x for Drupal 6.x is a complete revamp of the entire suite of modules, so the above patch won't apply.

That said, the same principles coulkd be applied. Do you have a live project I can help with? The project I used the above patch for is fine to stick with Drupal 5.x so I have no reason to "upgrade" that patch..but if you have a live project that requires it, drop me an email.

dub

Sankar-2’s picture

Hi Dub,
Tnx for ur reply. now am doing live project. i'm using drupal6, amazon s3 and ubercart 2. i configure amazon module but download link not working, for ex.., i purchased one digital product means only i receive shipping detail mail but download link didn't come. how to configure..? plz help me.

Sankar-2’s picture

Hi Dub,

How to show amazon s3 bucket product in drupal front page. i'm using drupal 6.14 , ubercart 2.x , amazon s3 bucket. please reply me, it's very urgent.

Thanks,
Sankar

Dublin Drupaller’s picture

Hi Sankar. I'm afraid I can't help much. I tried the ubercart amazon s3 module before but it wouldn't work for me. best to get in touch with whoever developed it (their contact details are usually in the readme.txt file that comes with the module.

Sankar-2’s picture

Okay thanks for your reply.

Dublin Drupaller’s picture

@sankar.

spotted this module. not sure if it will help, but might be worth a look: http://drupal.org/project/creeper

Sankar-2’s picture

Thanks dublin.

Sankar-2’s picture

Do you have any idea mysite module customization in drupal6.14 .its available only in drupal 5.3.If you have any idea customization of module or any other alternative solution for this issue.

capoyeti’s picture

Hi Sankar,

Did you find a solution that worked for you? I'm on the verge of kicking off a project that will require this integration (large files stored on S3) on Drupal 6.x

Thanks,
Chad

Status: Needs review » Needs work

The last submitted patch, file.module.patch, failed testing.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.