# Dynamically Defined URLs on S3

**URL:** <https://www.ruby-forum.com/t/dynamically-defined-urls-on-s3/184754>\
**Category:** Rails\
**Created:** [March 8, 2010, 6:18am UTC](https://www.ruby-forum.com/t/dynamically-defined-urls-on-s3/184754 "2010-03-08T06:18:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@sandy](https://www.ruby-forum.com/u/sandy)\
**Post date:** [March 8, 2010, 6:18am UTC](https://www.ruby-forum.com/t/dynamically-defined-urls-on-s3/184754/1 "2010-03-08T06:18:47Z")

</div>

I realize that S3 buckets do not contain folders, but that they do  
permit the use of filenames which contain the “/” character, thereby  
giving the appearance of folders (“pseudofolders”). I want to be able  
to save files in an S3 bucket, with pseudofolders where the  
pseudofolders are dynamically assigned based on the category of the  
file and the type of file.

For example, if I was saving John’s vacation photos, I would want them  
to appear in my bucket (“mybucket”) with the owner\_name of ‘john’ and  
category ‘vacation’, so that a photo having a filename ‘photo.jpg’  
would appear in S3 as  
[http://mybucket.s3.amazonaws.com/john/vacation/photo.jpg](http://mybucket.s3.amazonaws.com/john/vacation/photo.jpg).  
How do I accomplish this using paperclip?

I do not understand what I have to do to modify the  
default :url / :path so that I can create the desired result. In  
general, I would like to be able to control the full “path” between  
“mybucket” (the S3 bucket) and “filename”, so that I can access the  
file at  
[http://mybucket.s3.amazonaws.com//{whatever\_i\_dynamically\_create}/filename](http://mybucket.s3.amazonaws.com//%7Bwhatever_i_dynamically_create%7D/filename).

---

<div class="post-metadata">

**Author:** ![sandy](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/2bfe46/32.png) [@sandy](https://www.ruby-forum.com/u/sandy)\
**Post date:** [March 8, 2010, 9:06am UTC](https://www.ruby-forum.com/t/dynamically-defined-urls-on-s3/184754/2 "2010-03-08T09:06:11Z")

</div>

Sorry, I should have mentioned that I’m using Paperclip.
