Ask A Question

Notifications

You’re not receiving notifications from this thread.

File Uploads with Refile Discussion

Discussion for File Uploads with Refile

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.

Reply

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?

Reply
Johnny Mnemonic Johnny Mnemonic

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.

Reply

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...

Reply

Wondering if refile supports renaming files, when directly uploading to S3

Reply

Everything seems to work except after i follow the S3 steps, it still uploads to localhost.. any thoughts?

Reply
Reply

Is it possible to do image preview before we actually save the image?

Reply

Yes you can. This isn't specific to Refile, but just some regular Javascript hitting the browser File api. http://jsfiddle.net/LvsYc/

Reply

Looking for a way users can upload videos - there isnt much out there that clearly explains

Reply

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?

Reply

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.

Reply

What about paperclip ?

Reply

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?

Reply

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?

Reply

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.

Reply

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

Reply

please can you make a deployment to heroku with aws video with refile gem

Reply

If anyone runs into dependency issues with Rails 5 I found a good solution here: https://github.com/refile/r...

Reply

Thank you so many times over. This was a life saver!

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,464+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.