最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

php - iPhone Force Download Files? - Stack Overflow

matteradmin3PV0评论

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.

Post a comment

comment list (0)

  1. No comments so far