0

I don't have an iPhone so it's hard for me to test this, but I believe at the moment if someone downloads a JPG file from my site they then have to locate their Files app, and find the Downloads folder within it. Does that sound right?

I'd like for it to end up in their Camera Roll instead - is that possible? I couldn't find any resources on the subject.

Thank you

Codemonkey
  • 4,455
  • 5
  • 44
  • 76

3 Answers3

1

It depends on the browser app, but mostly user have 2 options:

  • 'Save' image -> it's going to Camera Roll
  • 'Share' image -> they can select where to send image, including Files app
Viktor
  • 1,020
  • 1
  • 9
  • 22
  • I guess you're talking about if the image is visible on the page and they've done a long-press on it? I'm talking about a thumbnail image with a "download full res version" button underneath it, and what happens when that button is clicked. Which then goes to a PHP page which loads the image and displays it with the headers `header('Content-Type: image/jpeg');` & `header('Content-Disposition: attachment; filename="photo234141.jpg");` – Codemonkey Mar 11 '22 at 10:59
1

This is not a programming question so it's technically off-topic for Stack Overflow. There is an option to "Add to Photos", which saves it into their Photos library and which is what most people would do. The option to download files, at least from Safari, is relatively new.

Jesper
  • 7,477
  • 4
  • 40
  • 57
  • I'm not sure that's true - I think my "download file" button has been working in Safari for a number of years - I just wanted to clarify where they end up, and if they can be directed to the Camera Roll instead. – Codemonkey Mar 11 '22 at 11:02
  • [It was apparently added in iOS 13](https://www.macrumors.com/how-to/access-download-manager-safari-for-ios/) so it definitely wasn't there from the beginning. No, you can't re-route the default download location or where "Save image" goes in any browser on any OS that I know of because that's up to the user, but you can encourage people to use the command that means "put this in my Photos app" if it is helpful for them to find your image there. – Jesper Mar 11 '22 at 11:50
1

It depends on the browser and it depends on how you are doing it.

If you are for instance downloading a file (that turns out to be an image) in Safari then that file will be downloaded into Files under downloads. You can select the file from your browser and use a "Share" functionality which opens a native dialog that shows all the applications that can accept this file type. Since it is an image one of the options will be to save it to photo library.

Still in Safari, if you long-press the image you will get a quick dialog with "Share...", "Add to photos" and "Copy".

In Chrome for instance long-pressing an image will show "Save Image", "Copy image", "Open image", "Open Image in New Tab", "Search Google for This Image" (And yes, sometimes "images" is capitalized and sometimes not :D). So you can clearly see that this "shortcut" menu really depends on the browser. There is no guarantee what user will get. A note here is that when selecting to save into camera roll ("Save Image" in this case) user may get a popup to give Chrome access to photos.

When I download a file in Chrome it just jumps to a preview. I assume that file is downloaded inside the application sandbox itself. I can not find it in "Files" app. I can however again "move" it from here. I can press "Downloads" which opens "Files" selector where I can select folder in which to download the image. Or I can long-press the image in preview and have the same list of options as described on previous paragraph.

So to answer your question(s)...

  • No, that unfortunately does not sound right. There is no telling where the downloaded file will end
  • No, you can not by any means force the image to end up in camera roll. And even if you did, your browser would need access to say the least.

And also there is no guarantee these paths will be or are preserved through OS versions or application versions or even device types...

Matic Oblak
  • 16,318
  • 3
  • 24
  • 43
  • I should have been clearer that I'm talking about a "download full res version" button, and what happens when that button is clicked. Not a long-press on a visible image. The download button then goes to a PHP page which loads the image and displays it with the headers `header('Content-Type: image/jpeg');` & `header('Content-Disposition: attachment; filename="photo234141.jpg");` In *that* instance, it sounds like it will end up in Files > Downloads, on Safari at least. I think I need to get my hands on an iPhone to test the Chrome experience... – Codemonkey Mar 11 '22 at 11:01