Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: File Uploads via Form CGI

From: rex:smallandmighty at: 21-Dec-2000 19:23

On Thu, Dec 21, 2000, Jeff Rubin <[webmaster--SILICONSPECIES--COM]> wrote:
>Does anyone have experience with accepting multi-part form data? >Meaning does anyone know how to accept a file upload via a form? >And if you do, is there a Rebol script example somewhere?
I've got code to do that in my Rebol webserver, it's going to take some pruning to remove the non-relevant bits, but yes, it can be done in Rebol, and it's not particularly difficult. Now that classes are over I should have some time to deskank and comment this code and make it generally available. What would probably help is if you dump all of the headers that the browser sends your CGI script to a file or bounce them back as a formatted web page, and then peruse them, it's very informative. From what I recall, in a multi-part post you have to parse out the unique ID string that the browser has separated the different parts with, and then parse the data using that string to separate it into the different parts, one of which will be the file uploaded. Also make sure that you use a loop while you read your data from the browser. If your uploading files, odds are, it's not all going to be sent in one chunk. In general, what will happen if you do one read, is you'll get enough data to get the headers, but not much if any of the posted data. .:Eric