admin管理员组

文章数量:1025457

I am trying to allow the user to download a file.

When the file is downloaded it is displayed in the browser window instead of downloading it.

Does anyone know of a way to get the iPhone to download files instead of viewing them.

Also all the code that I have tried works great on Android Devices.

Thanks.

I am trying to allow the user to download a file.

When the file is downloaded it is displayed in the browser window instead of downloading it.

Does anyone know of a way to get the iPhone to download files instead of viewing them.

Also all the code that I have tried works great on Android Devices.

Thanks.

Share Improve this question edited Sep 9, 2012 at 21:02 Alerty 5,9558 gold badges41 silver badges62 bronze badges asked Sep 9, 2012 at 20:53 OlokooOlokoo 1,1444 gold badges20 silver badges35 bronze badges 1
  • I have tried doc's and jpg's but the list is really unlimited. – Olokoo Commented Sep 9, 2012 at 20:59
Add a ment  | 

2 Answers 2

Reset to default 6

You can't. Apple have deliberately prevented things like this to protect their iOS from hacks and malware; you have no access (unless you are a developer, in which case its restricted) to the handsets integrated data storage.

Are you writing a program that downloads an image, or trying to do this as a user?

If you're writing a program, you can only download files to a limited number of locations. Your app's documents directory is the most obvious choice.

You will need to create an NSURLRequest, and then an NSURLConnection, and then implement a number of delegate methods to handle the ining data. Then you'll need to use NSFileManager methods to write the data to a file.

I am trying to allow the user to download a file.

When the file is downloaded it is displayed in the browser window instead of downloading it.

Does anyone know of a way to get the iPhone to download files instead of viewing them.

Also all the code that I have tried works great on Android Devices.

Thanks.

I am trying to allow the user to download a file.

When the file is downloaded it is displayed in the browser window instead of downloading it.

Does anyone know of a way to get the iPhone to download files instead of viewing them.

Also all the code that I have tried works great on Android Devices.

Thanks.

Share Improve this question edited Sep 9, 2012 at 21:02 Alerty 5,9558 gold badges41 silver badges62 bronze badges asked Sep 9, 2012 at 20:53 OlokooOlokoo 1,1444 gold badges20 silver badges35 bronze badges 1
  • I have tried doc's and jpg's but the list is really unlimited. – Olokoo Commented Sep 9, 2012 at 20:59
Add a ment  | 

2 Answers 2

Reset to default 6

You can't. Apple have deliberately prevented things like this to protect their iOS from hacks and malware; you have no access (unless you are a developer, in which case its restricted) to the handsets integrated data storage.

Are you writing a program that downloads an image, or trying to do this as a user?

If you're writing a program, you can only download files to a limited number of locations. Your app's documents directory is the most obvious choice.

You will need to create an NSURLRequest, and then an NSURLConnection, and then implement a number of delegate methods to handle the ining data. Then you'll need to use NSFileManager methods to write the data to a file.

本文标签: phpiPhone Force Download FilesStack Overflow