lundi 2 mars 2015

Errno::ENOENT - No such file or directory - Sinatra application image upload

I have this simple method that writes a file and returns it as part of an image upload to AWS...



def write_image_to_file(image, filename)
file = File.new("public/images/user_images/#{filename}", "w+")
file.write(image)
file
end


This works fine in development, the image uploads correctly and i get a URL of the AWS hosted image which i store in a database. However, when deployed to heroku, I get the following error message as part of the heroku logs...


Errno::ENOENT - No such file or directory - public/images/user_images/image.jpg:


The image doesn't upload. I thought it might be something to do with the public folder so have tried adding a ./ before public but this hasn't worked either.





Aucun commentaire:

Enregistrer un commentaire