Carlos Brando

Nome do Jogo

Uploading Files

A common task is uploading some sort of file, whether it’s a picture of a person or a CSV file containing data to process. The most important thing to remember with file uploads is that the form’s encoding MUST be set to “multipart/form-data”. If you’re using form_for just using file_field inside of it does the trick, but if you’re using form_tag :multi_part => true must passed as an HTML option, in the second options hash. If you forget to do this the file will not be uploaded.