File Uploads with Refile Discussion
Thank you for your videos!! I want to upload a image from a external application. How I can do that? I didn't find documentation about that.
Lots of different options here. Are you talking about importing files from somewhere else like through a Ruby script or something? Where are the images in the external application? Does it have an API?
Hi, thanks for this solution.
I new in Rails world.
Can i use this gem for upload large file (4gb+) on my locale-storage, without S3?
And in upload process "uploading file" writing in RAM memory or on hdd in temp?
(Because i have problem with simple upload form, first file write in RAM mem, and after in tmp file.)
Thanks.
That's a great question. I think Refile might not be ideal, but you can always ask the author on the Github issue tracker.
Another useful resource is: http://bclennox.com/extreme...
Everything seems to work except after i follow the S3 steps, it still uploads to localhost.. any thoughts?
Is it possible to do image preview before we actually save the image?
Yes you can. This isn't specific to Refile, but just some regular Javascript hitting the browser File api. http://jsfiddle.net/LvsYc/
Chris, I started using refile with more models (product model for avatars and message model for file sending) and realized all the things go to the same folder on S3. I also wanna upload files for the product model but it would be messy if everything was in the same folder (product avatar, product files and message files). I guess I will change the product avatar uploader to use carrierwave, but still the product files and message files will go to the same S3 folder which is not the best I guess. As I see in the docs/issues on github there is no way to put them into different folders. Did I miss something and I can put them into different buckets somehow? If I can't how I can make sure everything will be fine down the road?
I'm not sure why this isn't the default. It's a really important thing for managing a large set of files, so you'd think this was already in there.
I see a prefix option for the library that allows you to do this, but I don't see much information on how you'd set that dynamically.
This is the prefix option I'm talking about. You would need this to be set dynamically each time a different file type was uploaded which I don't know is very easy to customize.
Refile.store = Refile::S3.new(prefix: "store", **aws)
It's probably worth opening a Github Issue on the Refile to ask about this and see if there's currently a way to do that or if a patch needs to be made to support it.
There appears to be a problem with refile gem when using nested forms? I have a profiles form nested inside a users form, but when I upload the image, nothing happens. No errors are given, but profile images are not uploaded either. Anyone noticed this?
Thanks for this episode Chris. I implemented this and it works on my development server just fine. But when I deploy to production (Digital Ocean Ubuntu 16 with Capistrano and Nginx), i see the images upload just fine to s3 bucket, but unable to retrieve them. My nginx error log says:
"App 494 stdout: Refile::App: Error -> ImageMagick/GraphicsMagick is not installed"
but I have both imagemagick and graphicmagick installed on my server. What could be the problem here?
It's possible that Refile just isn't able to find the executable for imagemagick. It's looking for the "identify" command so you'll want to make sure that's in one of the folders in the PATH for the same user that Nginx is running as. I'd poke around at that and see if you can figure out why it might not be able to find the identify executable. If you installed imagemagick with apt-get then it should be available, but if you compiled it or something else, then it's probably just not in the PATH.
Can any one please help. i need to crop the image before uploading the image file to refile
couldnt find any solution with refile to crop the image.
Thanks
If anyone runs into dependency issues with Rails 5 I found a good solution here: https://github.com/refile/r...