Sheehan Alam
Sheehan Alam

Reputation: 60869

How to upload an image to a Ruby server?

I'm creating a simple HTML page that has an image upload. That image then gets sent to a Rails back-end (assume http://www.mycompany.com/myapp/post/).

I need to:

How would I do this?

Upvotes: 0

Views: 176

Answers (3)

Paul Sturgess
Paul Sturgess

Reputation: 3294

Another alternative is CarrierWave https://github.com/jnicklas/carrierwave

Upvotes: 0

Brian Glick
Brian Glick

Reputation: 2201

Use the excellent Paperclip plugin to do all of the work for you: https://github.com/thoughtbot/paperclip

Upvotes: 1

user668531
user668531

Reputation:

Rails or not, just:

<form action="URL_GOES_HERE" method="POST"
      enctype="multipart/form-data">

<input type="file" name="file"><br/>
<!--- USE HIDDEN FOR YOUR EXTRA PARAMS -->
<input type="submit">
</form>

Upvotes: 0

Related Questions