PDA

View Full Version : downloading and saving attachments from safari




shweta13
Sep 24, 2008, 10:52 AM
Hi all,

I want to download and store an attachment opened through safari on my iphone. can I do it? If not is there any other way to download and save attachments on iphone?



robbieduncan
Sep 24, 2008, 10:57 AM
You mean from within an application you are writing? This forum is for questions regarding writing software for the iPhone...

shweta13
Sep 24, 2008, 11:03 AM
You mean from within an application you are writing? This forum is for questions regarding writing software for the iPhone...

Yes,
I am opening safari thru my application...and I wish to download the attachment given on a particular URL and save it on my iphone...can i do it?

robbieduncan
Sep 24, 2008, 11:05 AM
Yes,
I am opening safari thru my application...and I wish to download the attachment given on a particular URL and save it on my iphone...can i do it?

No. You will have to use the correct APIs to do it yourself. I'd suggest some reading (http://developer.apple.com/documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html#//apple_ref/doc/uid/10000165). In particular you will want to use the NSURLConnection (http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/Reference/Reference.html#//apple_ref/doc/uid/20001697) class.

shweta13
Sep 24, 2008, 11:17 AM
No. You will have to use the correct APIs to do it yourself. I'd suggest some reading (http://developer.apple.com/documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html#//apple_ref/doc/uid/10000165). In particular you will want to use the NSURLConnection (http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/Reference/Reference.html#//apple_ref/doc/uid/20001697) class.

I know about NSURLConnection..The thing is...I had read it somewhere that we cannot save the downloaded applications on iPhone...that is the reason I was asking...anyways thanks for the help

robbieduncan
Sep 24, 2008, 11:22 AM
I know about NSURLConnection..The thing is...I had read it somewhere that we cannot save the downloaded applications on iPhone...that is the reason I was asking...anyways thanks for the help

You didn't say anything about applications. No you cannot download and run code (applications) directly or via Safari.

shweta13
Sep 24, 2008, 11:26 AM
You didn't say anything about applications. No you cannot download and run code (applications) directly or via Safari.

Does the same apply for the normal attachments also, such as documents,images etc?

robbieduncan
Sep 24, 2008, 11:30 AM
Does the same apply for the normal attachments also, such as documents,images etc?

You can download them if you want. You can only write directly to your own application sandbox so they will only be available to your own application.

firewood
Sep 24, 2008, 12:12 PM
I know about NSURLConnection..The thing is...I had read it somewhere that we cannot save the downloaded applications on iPhone...that is the reason I was asking...anyways thanks for the help

If the URL works, you can download and save most anything from an app. You can not run any applications however, downloaded or otherwise, except for maybe ones in plain javascript. Any applications you download will be stuck, unrunnable, inside a sandbox.