Reputation: 4043
I'm currently migrating my project from PHP (codeigniter) to Rails3 and it's amazing. But I'm a rails/ruby newbie so I've faced a problem which I don't know how to solve.
I get new stuff on my site (A) from one certain site (B). It works like this:
Sorry if the explanation is a bit cluttered.
For steps 1 and 2 I assume, I have to make a POST route and a method in some controller. But the rest isn't that clear to me.
Additionally, in php project I hosted files on the same servers. And now I use heroku, so I need to put those files to S3.
Upvotes: 0
Views: 1009
Reputation: 27603
update: On reading the Q again, I see that the remote files must be posted from a remote location into the rails app, not from a user-provided url. Carrierwave can most probably still deal with this, but I have no experience in this particular area.
This is really simple with carrierwave.
Once set up, carrierwave will detect wether something is either a file upload or a path to a remote file and import it.
<%= form_for @user, :html => {:multipart => true} do |f| %>
<p>
<label>My Avatar URL:</label>
<%= image_tag(@user.avatar_url) if @user.avatar? %>
<%= f.text_field :remote_avatar_url %>
</p>
<% end %>
S3 storage is supported natively, trough fog, wich needs no set-up or configuration other then a few lines in your uploader file in carrierwave itself.
Upvotes: 1