{"id":16656625,"url":"https://github.com/sheharyarn/s3_direct_upload_example","last_synced_at":"2025-05-12T22:31:28.309Z","repository":{"id":12276194,"uuid":"14898937","full_name":"sheharyarn/s3_direct_upload_example","owner":"sheharyarn","description":"Example RoR Application on using the s3_direct_upload gem","archived":false,"fork":false,"pushed_at":"2013-12-05T09:42:06.000Z","size":352,"stargazers_count":4,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-01T12:54:35.927Z","etag":null,"topics":["aws-s3","rails","ruby","uploader"],"latest_commit_sha":null,"homepage":"https://github.com/waynehoover/s3_direct_upload","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sheharyarn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-12-03T16:18:41.000Z","updated_at":"2017-11-12T17:51:35.000Z","dependencies_parsed_at":"2022-09-10T15:01:47.586Z","dependency_job_id":null,"html_url":"https://github.com/sheharyarn/s3_direct_upload_example","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheharyarn%2Fs3_direct_upload_example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheharyarn%2Fs3_direct_upload_example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheharyarn%2Fs3_direct_upload_example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sheharyarn%2Fs3_direct_upload_example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sheharyarn","download_url":"https://codeload.github.com/sheharyarn/s3_direct_upload_example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253833178,"owners_count":21971377,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-s3","rails","ruby","uploader"],"created_at":"2024-10-12T09:57:59.782Z","updated_at":"2025-05-12T22:31:27.929Z","avatar_url":"https://github.com/sheharyarn.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"S3 Direct Upload Example\n========================\n\nThis application was a result of [this](https://github.com/waynehoover/s3_direct_upload/issues/108). There was no simple example on how to use the `s3_direct_upload` [Gem for Rails](https://github.com/waynehoover/s3_direct_upload), so I decided to make one.\n\n\nGetting Started\n---------------\n\n1. Fork/Clone the repo\n\n2. Sign up for AWS S3 \u0026 set up **AWS Access Keys** ([How?](https://console.aws.amazon.com/iam/home?#security_credential))\n\n3. Create a Bucket and set the following `CORS Configuration`:\n\n  ```\n  \u003cCORSConfiguration\u003e\n    \u003cCORSRule\u003e\n        \u003cAllowedOrigin\u003e*\u003c/AllowedOrigin\u003e\n        \u003cAllowedMethod\u003eGET\u003c/AllowedMethod\u003e\n        \u003cAllowedMethod\u003ePOST\u003c/AllowedMethod\u003e\n        \u003cAllowedMethod\u003ePUT\u003c/AllowedMethod\u003e\n        \u003cMaxAgeSeconds\u003e3000\u003c/MaxAgeSeconds\u003e\n        \u003cAllowedHeader\u003e*\u003c/AllowedHeader\u003e\n    \u003c/CORSRule\u003e\n  \u003c/CORSConfiguration\u003e\n  ```\n\n4. Since your `s3_direct_upload.rb` initializer file is already set up, you just need to **Export your AWS Credentials** to environment (For Heroku, [see this](https://devcenter.heroku.com/articles/config-vars#setting-up-config-vars-for-a-deployed-application))\n     \n  ```\n  export AWS_S3_BUCKET=your-bucket-name\n  export AWS_ACCESS_KEY_ID=your-aws-access-key-id\n  export AWS_SECRET_ACCESS_KEY=your-aws-secret-access-key\n  ``` \n\n5. **Everything's done!** Start your rails server, and navigate to `http://0.0.0.0:3000` to see the app in action. \n\n\n\nWhere to go from here?\n----------------------\n\n- Read the [Official Documentation](https://github.com/waynehoover/s3_direct_upload) for `s3_direct_upload`\n- Understand the code. Important files to see are:\n   - `config/initializers/s3_direct_upload.rb`\n   - `app/views/documents/index.html.erb`\n   - `app/assets/javascripts/application.js`\n- Other, not-so-important files that've been changed:\n   - `config/routes.rb`\n   - `app/models/document.rb`\n   - `app/controllers/documents_controller.rb`\n   - `app/assets/stylesheets/application.css`\n\n\n\nMonkey Patch\n------------\n\nThis gem didn't work at first for me and [a couple of these guys](https://github.com/waynehoover/s3_direct_upload/issues/30). Turns out it had something to do with the URLs of the S3 Buckets. The problem was solved thanks to the [Monkey Patch by @k13n](https://github.com/waynehoover/s3_direct_upload/issues/30#issuecomment-14719437). I've added this patch to `config/initializers/s3_direct_upload.rb` file despite the fact that [these URLs are slower](https://github.com/waynehoover/s3_direct_upload/issues/30#issuecomment-14787558).\n\nIf you're feeling brave, try using the app without the patch.\n\n   \n\nOther Crap\n----------\n\nThe code wasn't meant to offend anyone. I only tried to make a simple example to get people started with the beautiful `s3_direct_upload` gem. If you find something that can be done in a better (and simpler) way, do let me know.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheharyarn%2Fs3_direct_upload_example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsheharyarn%2Fs3_direct_upload_example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsheharyarn%2Fs3_direct_upload_example/lists"}