I am trying to be able to upload files with Sinatra. I have the code here, but I'm getting the error "method file_hash does not exist" (see /lib/mvc/helpers/helpers.rb).
What is going on here? Is there some dependency I'm missing.
I am trying to be able to upload files with Sinatra. I have the code here, but I'm getting the error "method file_hash does not exist" (see /lib/mvc/helpers/helpers.rb).
What is going on here? Is there some dependency I'm missing.
I've had good luck with the example code found on this thread.
Including it here in case the link ever disappears:
Then your view would look like this. This uses HAML, but the important part is not to forget to set the enctype in your form element, otherwise you will just get the filename instead of an object:
I found, slightly changed and used this:
The original is at https://github.com/tbuehlmann/sinatra-fileupload but have some config issues at my environment. Don't forget to add
enctype="multipart/form-data"
andmethod="POST"
at the upload form.