Rails - Active Storage with direct upload - problem downloading directly with a zip file
I use Active Storage with the direct upload method to upload a file with an article.
The method : https://guides.rubyonrails.org/active_storage_overview.html#direct-uploads
On the show page, I give the possibility to download the file.
The link :
<%= link_to @post.document.filename, rails_blob_path(@post.document, layout: "attachment") %>
The link works with image or pdf files but does not work with zip or word files.
Because the preview page opens but I want a direct download.
I have tried different links, but it still doesn't work with zip files :
<%= link_to("download", cloudinary_url(rails_blob_path(@post.document), :flags=>"attachment" )) %>
<%= link_to @post.document.filename, @post.document, :flags=>"attachment" %>
<%= link_to @post.document.filename, @post.document, fl_attachment: "", target: :blank %>
<%= link_to "download", rails_blob_path(@post.document, disposition: :attachment) , flags: "attachment" %>
<% end %>
<%= link_to rails_blob_path(@post.document, disposition: "attachment"), target: "_blank" do %>
<%= link_to "download", url_for(@post.document), download: '' %>
<%= link_to 'download', @post.document.attachment, download: @post.document.attachment, download: '', target: "_blank" %>
<%= link_to 'download', @post.document.attachment, type: 'raw', download: '', target: "_blank" %>
Without the direct upload method, the link works with zip or word files.
Can you help me? Do I need to add a specific tag to link_to? Or change the settings of my Cloudinary account?
-
Hi Aubry,
I see you had a ticket open with us directly via Zendesk about this issue where you provided additional information. I will be following up in that thread shortly. Once resolved I'll share the resolution in this thread too.
0
Post is closed for comments.
Comments
1 comment