Question

i have one problem I save my upload data in the blob file type in the database..

now i want to download it..

how to manage that

i have try this way (document_file is a field with blob data)

send_file @attachment.document_file, :disposition => 'attachment'

but comes error...

anyone can help?

Thanks :)

Was it helpful?

Solution

Maybe you should use send_data for a blob data instead of send_file:

send_data @attachment.document_file, :disposition => 'attachment'

Consider that 'attachment' is the default value, so you can omit it. You should get this error because send_file needs a file path as argument, not a blob.

You can also take a look at: http://api.rubyonrails.org/classes/ActionController/Streaming.html#method-i-send_data

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top