开发者

Creating FTP Accounts with Rails + S3

Is there a way to crate a ftp account to a specific folder inside a bucket in s3 with rails?

I need users to upload files via ftp to a batch folder. Since files are both big in size and large in quantities i guess the best choice is via FTP and avoid all web uploading.

Let's say i have a User model with a role collaborator. When is a collaborator he can log with his username (user1) / password on let's say ftp.mysite.com and go to

s3.amazonaws.com/mybucket/b开发者_开发技巧atches/users/user1

Any idea how to accomplish this?

Thank you.


Since the users interacts with FTP and not with a web app, you can implement a plain Ruby script instead of a Rails web application.

  • Every user has own FTP area to upload files to; ftp.mysite.com/user1, ftp.mysite.com/user2, ...
  • Periodically a script checks if there is any new file in users' FTP folder using net/ftp standard library
  • If there is any, uploads the file so S3 via AWS::S3, eventually creating the folder on the S3 bucket if its missing
  • Once uploaded to S3, the file is deleted from FTP

Notes:

  1. Every user should access only to own FTP folder, while the Ruby script should access to any FTP folder
  2. If your users can use FTP, they can probably use Amazon S3 Organizer(S3Fox), Cyberduck or other S3 client. Create a bucket, users and folders then play with S3 ACL to define their privileges.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜