• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: HTTP Uploading
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: HTTP Uploading


  • Subject: Re: HTTP Uploading
  • From: Dave Dribin <email@hidden>
  • Date: Mon, 25 Jun 2007 13:15:47 -0500

On Jun 24, 2007, at 8:01 PM, Carter R. Harrison wrote:
This was sort of asked once before but there was never a clear answer.. so here goes again.

I have some data that I need to upload to a web server via an HTTP POST method. Doing GET's and downloads is very easy with Cocoa's URL Loading System, but it's not clearly outlined how to do file uploads. Can somebody point me in the right direction on how to do this?

First off, you should probably post networking questions on the macnetworkprog list:


  <http://lists.apple.com/mailman/listinfo/macnetworkprog>

Personally, I'd use libcurl. I spent a lot of time messing around with NSURLConnection and uploads, and it has some serious limitations if you're doing multipart POST upload:

* Must build multipart post body yourself using NSData.
* Building the body requires it must live entirely in memory (bad for large files), or use of a temporary file.
* Does not support the "Expect 100-Continue" header (bad for basic- auth protected uploads).
* No delegate for upload status to use as a progress indicator.


I've got an Obj-C wrapper around libcurl you may want to look into:

  <http://ddribin.googlecode.com/svn/trunk/ddcurl/>

It's still a work in progress, but I'm using it right now for multipart POST uploads on a client project.

If you *do* want to use NSURLConnection, take a look at another project I started:

  <http://ddribin.googlecode.com/svn/trunk/nsurl/>

This was going to be a project to help use NSURLConnection for stuff like uploads and authentication, but I'm giving up on it for ddcurl, instead. The code may be helpful, though.

-Dave

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >HTTP Uploading (From: "Carter R. Harrison" <email@hidden>)

  • Prev by Date: [OT] Don't draw every 10th sample(!) (Was Re: Best drawing technology for audio waveforms, envelopes, etc.?)
  • Next by Date: Re: int to NSString?
  • Previous by thread: Re: HTTP Uploading
  • Next by thread: Re: HTTP Uploading
  • Index(es):
    • Date
    • Thread