0

I'm using Android device to upload file to server by using POST method. But I don't know how to make Rails handle this event. It means, after Android device sends file to server by method POST by the link : http://localhost/upload_file, rails server can handle this event, and put this file into database, for example.

I have google and some results that tell me use additional plugin. Does exist any pure method just use rails only ? Please tell me.

Thanks :)

1 Answer 1

2

Rails can handle file uploads pretty easily. Here is the relevant guide that you should read: http://guides.rubyonrails.org/form_helpers.html

Here's a small snippet from the guide:

5.1 What Gets Uploaded

The object in the params hash is an instance of a subclass of IO. Depending on the size of the uploaded file it may in fact be a StringIO or an instance of File backed by a temporary file. In both cases the object will have an original_filename attribute containing the name the file had on the user’s computer and a content_type attribute containing the MIME type of the uploaded file.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.