16

Is there any way to use <input type="file"> in Safari on iPhone/iPod Touch? Or is there something similar that I can use inside the browser? I want to upload a photo from the device to my database using the browser.

TRiG
  • 9,687
  • 6
  • 54
  • 105
Sam Williams
  • 723
  • 1
  • 6
  • 13

3 Answers3

19

This is possible with iOs 6 or greater (http://www.apple.com/ios/whats-new/#safari). The browser renders

<input type="file">

and clicking on "Choose File" prompts the user to take a new photo or choose existing from the photo library.

tie
  • 543
  • 6
  • 13
  • 8
    This method is very buggy, as you should use `` instead. See [Andy's post](http://stackoverflow.com/questions/5784352/iphone-file-upload-with-html#answer-19576153). – Slavik Meltser Feb 27 '14 at 16:08
  • How to do it for audio files? `accept="audio/*"` doesn't work. – Adil Malik Apr 17 '14 at 17:38
  • Audio is part of the spec (http://w3.org/html/wg/drafts/html/CR/forms.html#attr-input-accept) but it is up to the browser to support it or not and currently safari for ios does not. Found this table for browser support (a bit old) http://books.google.com.au/books?id=gswdarRZVUoC&lpg=PA263&dq=file%20upload%20compatibility%20table&pg=PA263#v=onepage&q=file%20upload%20compatibility%20table&f=false – tie Apr 26 '14 at 06:53
  • Can we able to upload pdf document ? – Yash Vekaria Apr 08 '20 at 12:37
6

Can't be done with plain XHTML/javascript as Safari does not support uploads. See this previous question for a potential workaround solution to upload photos.

Community
  • 1
  • 1
Julio Gorgé
  • 10,018
  • 2
  • 44
  • 60
  • 1
    Honourable mention to http://picupapp.com which performs a similar function to the Google code, and is already deployed to the app store. – Ben Feb 12 '12 at 15:01
  • 2
    Now, in iOS 8 Safari mobile supports image upload – Raul Pinto Oct 14 '14 at 13:34
  • Safari on iOS6.0+ supports image/video upload & capture through ``, see [this answer](http://stackoverflow.com/a/40529202/813988) – Octavian Naicu Nov 10 '16 at 14:03
0

I had the same problem today. The alternative browser iCab Mobile does support file uploads. I got it for my iPad and (at least for me) file upload works fine.

TRiG
  • 9,687
  • 6
  • 54
  • 105
Piotr Justyna
  • 4,622
  • 3
  • 23
  • 40