Skip to main content

Force "Save As" Dialog

Answered

Comments

26 comments

  • Official comment
    Yakir Perlin

    Hey Martin,

    We recently added the ability to change the file name with using fl_attachment.

    For example, the following link will download the image "newname.jpg":

    http://res.cloudinary.com/neta/image/upload/w_800,h_800,c_fill,g_auto,fl_attachment:newname/telaviv.jpg

    Please let me know if it works for you.

    Cheers,

    Yakir

  • Itay Taragano

    Hi Ludger,

    Cloudinary supports delivering uploaded images as attachments using their original file names.

    You can use the  flags  transformation parameter to  attachment , or add  fl_attachment  to transformation URLs.

    The original file name of all newly uploaded images is now stored on our side for this purpose (for previously uploaded images the public ID would be used).

    You can set the flags transformation parameter to attachment, or add fl_attachment to transformation URLs.

    Here's a sample uploaded image delivered inline:

    http://res.cloudinary.com/demo/image/upload/v1362144095/sample_attachment.jpg

    Same uploaded image with the attachment flag, downloaded as the original file name ('Custom File Name'):

    http://res.cloudinary.com/demo/image/upload/fl_attachment/v1362144095/sample_attachment.jpg

    When using PHP, simply add  "flags" => "attachment"  when building transformation URLs of uploaded images.

    0
  • Ludger Rinsche

    is it possible to force the use of the id instead of the upload filename? Since the images are user-uploaded, the filename could contain private information.

    0
  • Itay Taragano

    Hi Ludger,

    You can set the  discard_original_filename  upload API parameter to  true  for making the files being downloaded as attachment don't use the original file name.

    0
  • Ludger Rinsche

    Thank you,

    can you tell me how to incorporate this parameter when building the upload string and signature manually? 

    0
  • Oliver Nassar

    Is it possible to define in the URL what the filename should be when it's downloaded?

    0
  • Itay Taragano

    Currently, we support either using the original uploaded resource's filename or the Cloudinary-defined public_id.

    We'll consider supporting pre-definition of the downloaded file in the future.

    0
  • Oliver Nassar

    Okay thanks Itay. For now, we'll need to proxy the download through our servers to enforce a filename that makes sense to the user.

    0
  • Itay Taragano

    Hi Oliver,

    Thanks for the update. As an alternative, if the new filename is a string that doesn't change often, you may want to consider simply renaming the public_id of the resource before requesting it. If so, make sure the `discard_original_filename` flag is included at the upload's parameters.

    0
  • Oliver Nassar

    I'm reluctant to change the public_id of a resource just to push a specific filename to the user. Feels a bit heavy-handed, you know?

    0
  • Itay Taragano

    Makes Sense, Oliver. We'll be happy to update here once we end up supporting an alternative in the future.

    0
  • Oliver Nassar

    Okay. I'll be waiting patiently :)

    0
  • Frederik Beun

    Any update on this?

    We have the same request:

     

    On our website we would like to be able to download images.
    By using the parameter `fl_attachment` we achieved this.
    Unfortunately enabling this 'attachment' parameter, this results in downloading the file with the original file name. (As mentioned here: https://support.cloudinary.com/hc/en-us/articles/202521252-How-can-I-deliver-an-image-as-an-attachment-)

    Is there a possibility to make use of the 'attachment' parameter in combination with the 'suffix' option. Which would result in a forced download with a custom name instead of the original name?

     

    0
  • Itay Taragano

    Hi Frederik,

    This is still on our to-do list to support. While there's no ETA for this at the moment, we'll definitely update here as soon as such a feature becomes available.

    0
  • Marco Janc

    This feature is very usefull for us and will save a lot of time for many cloudinary users, who manually have to rename downloaded. I already opened an related issue #59925, where content-disposition filename is lost in URL fetching.

     

    Feature request: Allow optional definition of filename. (addition to public-id)

    If user opens a cloudinarey image url and wants to download it, you must add this optional filename as content-disposition filename header to the response. Automatic URL fetching shall save this new filename property automatically from original content-disposition.

     

     

    0
  • Yakir Perlin

    Hi Marco,

    You are absolutely right, and our Product Team is working on that. 

    We'll update here as soon as such a feature becomes available.

     

    Best,

    Yakir

    0
  • Martin Pernecky

    Any progress/ETA on the custom filename feature?

    0
  • Martin Pernecky

    Generally it works, but:

    • I can't use a dot in filename e.g. ... `fl_attachment:new%23name` ... or `fl_attachment:new.name`
    • I can't change the extension, but maybe that's a security feature (very minor issue)
    • There is no corresponding fl_inline parameter to send `content-disposition: inline, filename=..... `
    2
  • Marco Janc

    Yes the corresponding fl_inline is also required. Our users want to open a PDF in a new tab / window and then decide if they need to download it - with the new name.

    0
  • Shirly Manor

    Hi Marco,

    You can show your image and add a button to download the image.

    If the user would like to get the image he can then press the download and get the fl_attachment:my-image image.

    Please let me know if that answered your question,

    0
  • Oliver Nassar

    Amazing to see this is available now. Any chance there will be support for adding a period? We want to force file downloads like "file.01"

    0
  • Loic Verger Del Bove

    Hi Oliver,

    We do support the dot symbol in the fl_attachment flag by using its double URL escaped version: %252E. And here is an example: https://res.cloudinary.com/demo/image/upload/fl_attachement:file%252E01/sample.png

    Please let me know if that helps.

    Best,

    Loic

     
    0
  • Oliver Nassar

    Hi Loic -

    That URL fails for me: https://imgur.com/jrxFZWW

    0
  • Loic Verger Del Bove

    Hi Oliver,

    My bad, an `e` appeared in `attachment`, you can try this link : https://res.cloudinary.com/demo/image/upload/fl_attachment:file%252E01/sample.png

    Please let me know if that helps.

    Best,

    Loic

    0
  • Oliver Nassar

    Awesome thanks so much!

    0

Post is closed for comments.