IOS – Downloading and uploading files through Safari iOS

iosmobile-safari

I am aware that iPad does not have a file-system in traditional sense.

I want to know how Safari for iOS behaves when trying to download/upload files from/to a website.

Suppose I go to sourceforge.net and click on a link to download zip file? Would Safari download it? If yes, where does it get stored and how do I access it (without using iTunes to first move it to a PC).

Does Safari on iOS allow the downloading of only some files and reject others, or does it allow downloading all of them or rejects all of them?

Lastly, if a webpage has a file upload control (input type="file"), how does Safari behave (would it allow upload, allow upload on only some sites or the download control does not work at all)?

Best Answer

Actually the iOS does have a filesystem, and each app gets access to a sandboxed portion of the file system.

The iOS "system" itself has several programs that do access the filesystem directly, but mobile safari acts more like a restricted app purchased from iTunes than say springboard or the app store app itself.

Uploads are basically impossible in iOS. Mobile Safari doesn't read from the address book (which most sandboxed apps can and will do by default). It also doesn't use the photo picker to upload pictures or video.

Downloads are possible, but often require a helper app to store and use the download. Safari handles mp3, streams, and other media itself and lets you listen or watch the "download". You can't save it in the way a computer allows, but the web server thinks a download happened and safari actually downloads the file to it's cache (where it stays until the cache fills and it ages out and gets deleted). All other file types are handled as the iOS uses UTI file detectors to see which apps installed can handle a potential download. (The developer document I linked to has several paragraphs readable by anyone, but it dives into developer minutia very quickly so feel free to bail on that link before the simple idea behind UTI gets confused)

If safari detects another app has registered for a download, you will see an "open in apptastic" to indicate that mobile safari will download that file but hand it off to another app to store in that app's sandbox.

Safari uses a system API call to have the iOS do the writing across sandboxes.


Since you asked about a zip file, all you need on your iPad is to find an app that tells iOS it can handle zip files, and as long as the sourceforge servers send enough data for mobile safari to detect a zip file, you can download it over to your app. The reverse trip is harder, your ZIP app can't really push a file to safari for upload. Your app has to be programmed to log into sourceforge directly and call the upload API itself. (which technically will probably use the mobile safari code / webkit to do a http upload - but that all happens behind the scenes, not in what we see and control as mobile safari with the blue compass icon)

Related Question