NetTalk Central

Author Topic: WebClient: POSTing large files  (Read 3946 times)

CyberFerret

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • Email
WebClient: POSTing large files
« on: December 01, 2008, 10:24:55 PM »
Hi all,

I was reading through the NetTalk documentation, and it explains nicely how to break up a binary file into a multi-part file so you can POST it to a web server via the webclient object.

Problem is, we are looking to post very large ZIP files using http POST - in the order of 1MB to 10MB files.  What is the best way to either stream, or break down these files into chunks and convert to multi-part data?

NB: I know this is more of a webclient question rather than webserver, but there is no forum here for wc stuff! :)

Thanks,
Devan

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: WebClient: POSTing large files
« Reply #1 on: December 01, 2008, 11:43:05 PM »
The size of the file is not relevant.
You need to do it the way the docs specify.

The http post is sent from a string, so sooner or later the file has to be loaded into ram.

cheers
Bruce

CyberFerret

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • Email
Re: WebClient: POSTing large files
« Reply #2 on: December 02, 2008, 12:40:51 AM »
Hi Bruce,

Now I am confused - the document says to build the PostString as thus:

PostString = '--' & Clip(mimeBoundary) & '<13,10>' |
            & 'Content-Disposition: form-data; name="SessionID"<13,10>' |
            & '<13,10>' |
                       & Clip(sessionID) & '<13,10>' |
            & '--' & Clip(mimeBoundary) & '<13,10>' |
            & 'Content-Disposition: form-data; name="thisFormData"<13,10>' |
            & '<13,10>' |
                       & Clip(PostForm) |
            & '--' & Clip(mimeBoundary) & '<13,10>'


And I am assuming that the variable PostForm above is the binary contents of the file we are trying to upload.  I am not sure how to handle it if the file is 1MB in size - wont the PostString variable max out at 16K or whatever and truncate the rest of the file data?

Thanks,
Devan