• 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: streaming upload of a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: streaming upload of a file


  • Subject: Re: streaming upload of a file
  • From: Alexey Proskuryakov <email@hidden>
  • Date: Wed, 06 Jul 2005 10:29:18 +0400

  So far, the answer is that there are some problems with subclassing
NSInputStream that may prevent it from working, so for now our best bet is
probably to use a temporary file.

On 22.06.2005 23:51, "Alexey Proskuryakov" <email@hidden> wrote:

>
>    I have used a DTS support incident to ask for sample code doing exactly
> this job; it is currently in progress. It may even result in a public
> technote, otherwise, I will hopefully be able to post some detailed info when
> I get it.
>
> On Wed, 22 Jun 2005 11:11:02 -0700 Becky Willrich <email@hidden> wrote:
>> Hi Tracy -
>>
>> What you need is to define your own kind of stream; the best way to  do that
>> is unfortunately at the Foundation layer - you can subclass  NSInputStream
>> and implement your own backing store to be the data you  want followed by the
>> contents of the file you want.
>>
>> Using only CFNetwork and below, your best bet is to create a  temporary file
>> that's a copy of the data to be uploaded, then use  plain ol' file system
>> calls to insert the extra bytes you need at the  beginning, then create a
>> read stream from the temporary file and pass  that to CFNetwork.  Once the
>> stream has finished its work, you can  delete the temporary file.
>>
>> Hope that helps,
>> REW
>>
>>
>> On Jun 22, 2005, at 11:02 AM, Tracy Stampfli wrote:
>>> I am using CFNetwork to upload files using HTTP POST multipart/form-
>>> data requests. This works fine for small files, but I would like to
>>> be able to upload larger files without having to read the entire
>>> file into memory in order to create the body of the request.
>>>
>>> Currently, since the body of my request has to include both the
>>> file data and the form data (boundary strings, etc.). I create a
>>> buffer, fill it with the form elements and file data, call
>>> CFReadStreamCreateWithBytesNoCopy to get a stream from the buffer,
>>> and then call CFReadStreamCreateForStreamedHTTPRequest to make my
>>> request.
>>>
>>> What I would like to do is get a stream to the file (with
>>> CFReadStreamCreateWithFile, presumably) and create the request from
>>> that stream, without reading the file into memory. The problem is
>>> that if the file stream is used as the body of the request, I can't
>>> include other any data in the body, like the form elements. Is
>>> there any way to stream in the file as part of the body of the
>>> request, but still add other data?
>>>
>>>
>>> -Tracy

- WBR, Alexey Proskuryakov


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Accessing OpenSSL functions from CFM Carbon under Tiger
  • Next by Date: Receiving AFP server notifications
  • Previous by thread: ICLaunchURL problem
  • Next by thread: Receiving AFP server notifications
  • Index(es):
    • Date
    • Thread