uc_file_amazon_s3

Contrib type: 
Module
Status: 
Initial upload

Downloads

Compatibility: 
Ubercart 1.x

File Download Product served from Amazon S3 for Ubercart.

Product downloads are stored and served on/from your Amazon S3 account. All files are set at private, so the files are secure. Preventing people from downloading them without first buying them.

All features of the original uc_file module are functional.

Update: May 28, 2008 I got a private message from someone asking me about the state of this module. I uploaded my current code which I use on several sites with Ubercart RC4. Basically overwrite the uc_files module with these files. I haven't done anything with it for long time. Read the readme. But here it is, and it works, but the way it works is you have to setup a subdomain and point it to amazon s3 via cname record change, and create bucket with full subdomain name. Probably none of this makes sense.

Currently this is a wholesale replacement of uc_file. Meaning you can NOT use both at the same time because I didn't change the module name.

The code is identical to uc_file except I changed the relevant parts to interface with Amazon S3 instead of your local file system.

You need an Amazon S3 account. And you have to edit the s3.class.php file by adding in the API key ID and secret key that you get from Amazon.

The your bucket name must be unique across all Amazon S3 accounts.

The only current limitation is the size of uploaded files. As they first have to be uploaded to your server and then transferred to Amazon. They claim that they will be releasing a new feature to upload straight to Amazon from a post form by the end of the year.

There is also not much in the way of error checking, if something fails. In particular file uploads.

So I wanted feedback as to whether I should make a new module or try to combine the two? I'm sure people will say combine them, but I'm not really up to doing the work for that.


PreviewAttachmentSize
uc_file.zip38.57 KB
uc_file.zip (May 28, 2008)45.03 KB
Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15450
Re: uc_file_amazon_s3

Awesome work! Honestly, I don't mind if you leave this up here as a wholesale replacement of uc_file.module, though we'll understandably need to keep the core module storing files locally. If you ever get the chance to merge it somehow, let me know.

The main problem here is if a bug gets fixed in the core module it won't necessarily get ported to yours. You can use our commit log to see when uc_file.module gets changed.

agilpwc's picture
Offline
Joined: 12/10/2007
Juice: 213
Re: Re: uc_file_amazon_s3

Yes I plan on keeping it up to date.

Probably every time you make a new release.

Shawn Conn's picture
Offline
Administrator
Joined: 08/07/2007
Juice: 919
Re: Re: Re: uc_file_amazon_s3

Either way you go (standalone replacement or separate module), you're going to have to keep up maintenance with changes with uc_file and other core modules. That being an unavoidable issue, I think, for the sake of keeping the codebase small, that a separate module is the way to go. Using hooks like hook_form_alter should enable you to modify the existing forms to add S3 functionality to the uc_file module. If you'd like assistance or need changes to uc_file to accommodate this module, PM me.

On the note about the code, I note in the README file that installation of the module requires you to edit one of the PHP files. I'd recommend storing this information in a drupal variable, by creating a form with system_settings_form. This makes the process of upgrading to future revisions much easier.

-Shawn Conn: If the Name Don't Rhyme It Ain't Mine

skabenga's picture
Offline
Joined: 08/28/2008
Juice: 4
Ubercart 2 Version

This module sounds like it is perfect for selling large files off amazon s3.
Are there any plans for an Ubercart 2 version of this module? I really think it is a worthwhile one to update.
I would be happy to test.

Thanks
Gregg

thiokol's picture
Offline
Joined: 05/07/2009
Juice: 69
amazon s3

I would also be very interested in a 2.x version

thiokol's picture
Offline
Joined: 05/07/2009
Juice: 69
please help!

hi

I've went ahead and setup drupal 5 and ubercart 1 so I can use this module.

My amazon s3 account is setup and the CNAME record is working, I can access files in my bucket on my s3 account via files.mydomain.com.

I edited s3.class.php and entered my key and secret key where required and uploaded the uc_file directory overwriting any existing files.

I enabled file uploads for ubercart product feature and entered the bucket name for file downloads location: files.mydomain.com

When attaching a file when adding a product, the file still uploads to the drupal file system and not my amazon s3 bucket, i.e.: http://www.mydomain.com/files/filename.mp3

also when i edit a product and add feature > file download, any filenames i enter i get the error "filename.mp3 is not a valid file or directory inside file download directory."

is there anything i might not have done correctly? any suggestions of things to try?

Thanks

royerd's picture
Offline
Joined: 01/22/2008
Juice: 295
update?

Could you provide a quick update on the status of this code? Does it work well?

I read in another post that it works by providing a URL that expires after a certain amount of time. Our workflow requires that a user has access to his/her files for a year--at which time they lose a role and thus lose permission to download.

Would this code of yours work in that situation?

Thanks,

Dan

ryanschmidt's picture
Offline
Joined: 11/17/2008
Juice: 235
Re: uc_file_amazon_s3

I am getting this error:

warning: require_once(PEAR.php) [function.require-once]: failed to open stream: No such file or directory in (...)\modules\ubercart\uc_file\Request.php on line 46.

ryanschmidt's picture
Offline
Joined: 11/17/2008
Juice: 235
Re: Re: uc_file_amazon_s3

I was able to find the PEAR.php file and then just put it in the "includes" folder

ryanschmidt's picture
Offline
Joined: 11/17/2008
Juice: 235
Re: uc_file_amazon_s3

For those finding this page, like I did, and wondering if it still works: yes, it does. I was able to set it all up fairly quickly. Once I got the CNAME and everything setup the config for the module was very straightforward. I am not sure what the module creator means about uploading the file directly to your domain and then transferring to s3. I was able to upload direct to s3, match my cname to my s3 bucket name and then the files showed up automatically in my Drupal File Download list. I was able to pair the downloads to a product on the Features page and just now confirmed that the download limits work correctly.

Just wanted to document this for anyone finding this module potentially useful. Thank you so much to the creator of this.

vebfilm's picture
Offline
Joined: 08/26/2009
Juice: 24
Ubercart 2 Version

This would be exactly what I need - any chance to get it running on Ubercart 2?

best, stefan

sharkal's picture
Offline
Joined: 09/28/2009
Juice: 5
Upgrade to 2.x

I'm ready to pony up $$ to get this upgraded to 2.x. What's it gonna take?

Sankar's picture
Offline
Joined: 10/05/2009
Juice: 2
File Download Product served from Amazon S3 for Ubercart 2.x.

Hello,

Please help my live project, i am using drupal 6.14, ubercart 2.x, amazon s3.

How to configure Amazon s3 bucket in ubercart 2.

Thanks,
Sankar

bradleyvance's picture
Offline
Joined: 10/14/2009
Juice: 11
Agreed, we could really use this functionality in 2.x!

I'm willing to pitch in some $$ if there's anyone out there that can update this module.

ceege111's picture
Offline
Joined: 11/09/2009
Juice: 2
2.x version

I am working on upgrading this module but on a non-existent budget. Are you all still interested in paying for this work? I'm about 1/2 way through and have spent about $450 of time on it.

C.J.

LightFromArt's picture
Offline
Joined: 08/28/2009
Juice: 28
Re: 2.x version

Is it any progress to support 2.0?

Riki's picture
Offline
Joined: 01/10/2009
Juice: 196
This would be awesome!! Is

This would be awesome!! Is anyone working on this??

- Riki Babington
www.eat3d.com
Feed Your Brain!

justageek@drupal.org's picture
Offline
Joined: 10/28/2008
Juice: 93
here is someone willing to pay for this
qrandle's picture
Offline
Joined: 02/16/2009
Juice: 135
Re: 2.x version

I'm interested and have some $$ as well.

Quint

Riki's picture
Offline
Joined: 01/10/2009
Juice: 196
Re: uc_file_amazon_s3

Id also pitch in a couple hundred dollars for this.

- Riki Babington
www.eat3d.com
Feed Your Brain!

kheftel's picture
Offline
Joined: 03/24/2010
Juice: 37
Re: uc_file_amazon_s3

I am willing to update this code for Ubercart 2 and Drupal 6. I'd make it into its own module and would be willing to release it here as a contributed module here on ubercart.org. Those of you who said you'd contribute money for this module to be written, are you still game?

-Kawika
http://www.heftelstudios.com
"Life without music is a journey through the desert."

qrandle's picture
Offline
Joined: 02/16/2009
Juice: 135
Re: Re: uc_file_amazon_s3

I'm game.

vebfilm's picture
Offline
Joined: 08/26/2009
Juice: 24
Re: Re: uc_file_amazon_s3

I would appreciate if you do that! I can put in $50.

/Stefan
vebfilm.net

Riki's picture
Offline
Joined: 01/10/2009
Juice: 196
Re: uc_file_amazon_s3

$200 if its done well.

- Riki Babington
www.eat3d.com
Feed Your Brain!

qrandle's picture
Offline
Joined: 02/16/2009
Juice: 135
Re: Re: uc_file_amazon_s3

I can put in $100-$200 as well. Quint

kheftel's picture
Offline
Joined: 03/24/2010
Juice: 37
Re: uc_file_amazon_s3

Alright, sounds good. I'll let you know of my progress. The module will be hosted/released on ubercart.org. I'll let you know when the module page is up.

-Kawika
http://www.heftelstudios.com
"Life without music is a journey through the desert."

Riki's picture
Offline
Joined: 01/10/2009
Juice: 196
Re: uc_file_amazon_s3

Great, cant wait!

- Riki Babington
www.eat3d.com
Feed Your Brain!

kheftel's picture
Offline
Joined: 03/24/2010
Juice: 37
Module almost ready

Hey guys,
I'm just about ready to upload the Amazon S3 File Downloads for Ubercart module to drupal.org and ubercart.org. I'm doing final code cleanup, refactoring, and jumping through the hoops necessary to get the module posted, i.e. CVS account ,etc. I'll post here with the module page when it's all said and done.

In the meantime, those who said they would like to donate to help fund the project can click here:
Donate to Amazon S3 File Downloads for Ubercart 2.x and Drupal 6.x

Thanks!

-Kawika
http://www.heftelstudios.com
"Life without music is a journey through the desert."

Riki's picture
Offline
Joined: 01/10/2009
Juice: 196
Re: uc_file_amazon_s3

I almost posted to see the progress on this. I will gladly pay the $200 I promised but since I dont know you from adam I would at the very least need to see that the module works.

Thanks for the hard work on this man, cant wait to test it!!

- Riki Babington
www.eat3d.com
Feed Your Brain!

kheftel's picture
Offline
Joined: 03/24/2010
Juice: 37
Module for testing

Ok, to prove I've actually completed the said module, I'm attaching the code as it stands now. I'm still going through it, adding doxygen comments, cleaning it up, etc., but I wanted to make it available for people to test in its current state. It's passed all my tests and has met with approval from the client. Now it's time to get more people to test it before its initial release.

This module can be installed anywhere (i.e. sites/all/modules will work), but I since it's an Ubercart contributed module, I like to put it in modules/ubercart/contrib.

Enjoy, and happy testing! I'm interested to hear your feedback. I'll post here once I have the module up on drupal.org and ubercart.org (there's a lot more required than I thought to get the code posted, this is my first time developing for Drupal).

AttachmentSize
uc_file_s3.zip 31.32 KB

-Kawika
http://www.heftelstudios.com
"Life without music is a journey through the desert."

qrandle's picture
Offline
Joined: 02/16/2009
Juice: 135
Re: Module almost ready

I'm kind of in the same boat. I am totally on board and ready to donate, etc. But I just want to know/see that it works. Maybe look inside at the admin and test a download. The reason I'm skittish is cause I've already wasted about $300 on other "solutions" to this problem. Yours is the one that I want/need. I'm new to this donation/community thing too. How can we work this out?

Quint

qrandle's picture
Offline
Joined: 02/16/2009
Juice: 135
Re: Module for testing

Okay. Quint again. As a show of good faith and to get as many people on board as possible, I've made a donation of $100. I will donate some more once I get it installed (the finished version) and see it working, etc.

Let me ask a dumb question. Is there a specific or best type of Amazon S3 account to get?

Quint

kheftel's picture
Offline
Joined: 03/24/2010
Juice: 37
Re: uc_file_amazon_s3

Quint, I totally understand your hesitations. I am not exactly sure how to go about negotiating payment, quality of work, etc, when we have never met each other. However, in my reply above, you'll see that I posted the code as it now stands. Please download it, check it out on your site, test downloads, and let me know if it works. I did forget to mention above that the module is dependent on the Amazon S3 module, my module uses Amazon S3's API to interact
with the S3 account.

Quint, sorry to hear about your getting burned trying to find a solution to this problem. I can assure you I'm trying my best to be honest and not rip anyone off, and you don't have to pay me if the module doesn't suit your purposes.

Please continue to post any questions/comments/concerns you may have. Thanks! I appreciate the generosity of everyone who's offered to contribute money to this development effort.

-Kawika
http://www.heftelstudios.com
"Life without music is a journey through the desert."

Riki's picture
Offline
Joined: 01/10/2009
Juice: 196
Thanks Kawika! I get off

Thanks Kawika!

I get off work in 5 min so I might try and test this tonight, if not I will first thing in the morning.

- Riki Babington
www.eat3d.com
Feed Your Brain!

kheftel's picture
Offline
Joined: 03/24/2010
Juice: 37
Re: Re: Module for testing

Quint, thanks for your donation! Your generosity and good faith is appreciated! I believe there is only one type of Amazon S3 account. Best place to go is here: http://aws.amazon.com/s3/. There's a "sign up for s3" button there. If you're new to S3, I HIGHLY recommend the S3Fox Firefox extension for learning how to administer your S3 account, uploading files, creating buckets, etc. It has a nifty GUI and is easy to understand.

-Kawika
http://www.heftelstudios.com
"Life without music is a journey through the desert."

qrandle's picture
Offline
Joined: 02/16/2009
Juice: 135
Re: Re: Re: Module for testing

Setting it now. Thanks for the tips.

kheftel's picture
Offline
Joined: 03/24/2010
Juice: 37
Applied for CVS Account

I have applied for a CVS account on drupal.org, if everything goes smoothly I should have the module up there within a week! *fingers crossed*

-Kawika
http://www.heftelstudios.com
"Life without music is a journey through the desert."

Riki's picture
Offline
Joined: 01/10/2009
Juice: 196
Re: uc_file_amazon_s3

Great work on this, I sent the $200 I promised to your PayPal.

Here is some feedback:

Good:
1. This seems to duplicate the default download features in every way. I love how it is even able to detect when a download was canceled or not completed, which doesn't affect their download count. Great job with this.

Concerns:
2. In my test the file download email only works if the user is logged into the site. If they aren't logged in they will get access denied. This isn't a big deal but if I remember right the default uc download allows the one-time links to be downloaded anonymously?

3. Since this will replace the normal file download method, is there a way to disable it so the user doesnt see "file" on the account page? It may be confusing to see both Files and S3 Files

Suggestions:
4. This is asking a bit much, but it would be awesome to have a feature to convert existing downloads to amazon s3. It could do a simple check for filename and if the file is found on amazon then it could switch the product feature from File Download to S3 File Download. It would need to preserve the options such as "SKU" and "Shippable".

5. Would it be possible to expose S3 downloads to views so we can show the current file downloads on their main account page in a panel or something so they can easily find it without having to click into the S3 tab?

Thanks again for the hard work on this. I would be willing to pay extra if you could implement the features I suggested, please let me know!

- Riki Babington
www.eat3d.com
Feed Your Brain!

deggertsen's picture
Offline
Joined: 09/01/2009
Juice: 20
Re: Re: uc_file_amazon_s3

I like your suggestions Riki and your concerns are the same ones I had. This S3 module does duplicate the uc_files module. uc_files can actually be disabled if you are only using file downloads from S3 and that would make it so that there are not two "Files" tabs on the user profile. But I think some people may need to use both and if that is the case it would be nice to have all of the file downloads go into the same "Files" tab on the user profile. That is one of my biggest requests.

Thanks for your great work on this Kawika!

Riki's picture
Offline
Joined: 01/10/2009
Juice: 196
Re: uc_file_amazon_s3

Thanks deggertsen, I totally forgot you can simply disable the other method.

1 other "possibly exotic" suggestion.

I have 20GB or more in file downloads for products. Its going to take me a long time to manually upload these from my current location. Is it at all possible to upload them from my webserver to the s3 bucket? I have a dedicated server and the speeds from there would be many MB/s instead of a few kb/s from here.

- Riki Babington
www.eat3d.com
Feed Your Brain!

qrandle's picture
Offline
Joined: 02/16/2009
Juice: 135
Re: Re: uc_file_amazon_s3

That would be good to know for me as well. I'm currently uploading about 90 GIgs to S3 bucket via the Firefox plug in, and it is darn slow.

Quint

agilpwc's picture
Offline
Joined: 12/10/2007
Juice: 213
Re: Re: uc_file_amazon_s3

telnet into your server and use http://s3tools.org/s3cmd to upload from your server to S3

Riki's picture
Offline
Joined: 01/10/2009
Juice: 196
Re: uc_file_amazon_s3

Thanks agilpwc, that worked beautifully.

- Riki Babington
www.eat3d.com
Feed Your Brain!

Riki's picture
Offline
Joined: 01/10/2009
Juice: 196
Re: uc_file_amazon_s3

Kawika - Is it safe for me to start configuring this on a production site? Your not going to make any big changes during the "clean up" of the code right?

- Riki Babington
www.eat3d.com
Feed Your Brain!

kheftel's picture
Offline
Joined: 03/24/2010
Juice: 37
Re: uc_file_amazon_s3

I apologize I haven't been able to respond to everyone on this issue yet, please rest assured I will. I've applied for and been granted a drupal.org CVS account. I'm in the process of adding the uc_file_s3 module to the repository and getting a module page up. Until that's done, you can use the cleaned-up version I've posted to this message. It should be good to go for testing in a production environment, and no, Riki, I'm not planning any drastic changes to it when I get it in the Drupal repository. Thanks for your patience everyone.

AttachmentSize
uc_file_s3.zip 29.52 KB

-Kawika
http://www.heftelstudios.com
"Life without music is a journey through the desert."

kheftel's picture
Offline
Joined: 03/24/2010
Juice: 37
Re: uc_file_amazon_s3

The Amazon S3 File Downloads module now has a project page at drupal.org, here it is:

http://drupal.org/project/uc_file_s3

Let's move the discussion to the issue queue at that page.

One thing, though - I tried to create a contributed project here on ubercart.org, and it said that the shortname uc_file_s3 is taken. Any ideas why? I would like to post it here at ubercart.org as well.

-Kawika
http://www.heftelstudios.com
"Life without music is a journey through the desert."

Riki's picture
Offline
Joined: 01/10/2009
Juice: 196
Re: uc_file_amazon_s3

Thanks. I just saw this too: http://drupal.org/project/uc_cloudfront
I wonder what the difference is.

- Riki Babington
www.eat3d.com
Feed Your Brain!

kheftel's picture
Offline
Joined: 03/24/2010
Juice: 37
Riki, the uc_cloudfront

Riki,
the uc_cloudfront module seems to work with CloudFront, rather than just S3. I don't know how much support it provides for uploading files to S3 or creating the cloudfront distributions. I'm gonna install the module on a test server and play around with it in the next few days and maybe I'll know more then.

-Kawika
http://www.heftelstudios.com
"Life without music is a journey through the desert."

Riki's picture
Offline
Joined: 01/10/2009
Juice: 196
Thanks! Ive been testing the

Thanks!

Ive been testing the s3 module quite a bit and it does exactly what you would expect it to do.

Its unfortunate that we probably wont be able to use it in production because of the file transfer speed from s3 to many parts of the world. I was under the impression S3 would be very fast around the world but its actually very slow to many popular locations like the UK. We have testers in London and were getting very poor speeds in many different tests and times of day. Since our files are very large (up to 1GB in size), speed and stability is very important.

Its possible that cloudfront could be of use because I read it has edge locations around the world, but I cant figure out the other module to test it well enough, plus it would be a little more expensive, but as long as its fast, stable and secure it would be of interest.

Thanks for your hard work Kawika, it was worth it to test out and see what s3 is capable of Smiling

- Riki Babington
www.eat3d.com
Feed Your Brain!

kheftel's picture
Offline
Joined: 03/24/2010
Juice: 37
Riki, That is unfortunate

Riki,
That is unfortunate about S3's storage speeds. I guess you could put your bucket in Europe, although I guess then it'd be slower to the US... wonder if you can sell one bucket to one area, and another to the other area? I would be willing to look into developing cloudfront capabilities into the module, is cloudfront more expensive to use from the Amazon end?

-Kawika
http://www.heftelstudios.com
"Life without music is a journey through the desert."