File Uploads via Form CGI
[1/8] from: webmaster:siliconspecies at: 21-Dec-2000 10:25
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?
Thanks,
Jeff
[2/8] from: gchiu:compkarori at: 22-Dec-2000 6:40
On Thu, 21 Dec 2000 10:25:01 -0600
"Jeff Rubin" <[webmaster--SILICONSPECIES--COM]> wrote:
> Does anyone have experience with accepting multi-part
> form data?
I haven't tried it, but look at this:
http://www.rebol.org/cgi/POST.html
--
Graham Chiu
[3/8] from: webmaster:siliconspecies at: 21-Dec-2000 15:00
Thanks!
I screwed around with it but can't seem to get it to work.
This is unclear to me, if you have a form with a file submit in it.
You submit that to a cgi and that cgi calls the multipart.r file?
but it won't work for me. I tried all kinds of configurations.
If you could assist that would be great...
Jeff
[4/8] from: gchiu:compkarori at: 22-Dec-2000 10:29
On Thu, 21 Dec 2000 15:00:14 -0600
"Jeff Rubin" <[webmaster--SILICONSPECIES--COM]> wrote:
> I screwed around with it but can't seem to get it to
> work.
<<quoted lines omitted: 5>>
> configurations.
> If you could assist that would be great...
I still haven't tried it :-)
But looking at the code, you just include that function in
your cgi script, and then
decode-multi %mydirectory true
--
Graham Chiu
[5/8] from: allenk:powerup:au at: 22-Dec-2000 7:39
Jeff,
Not sure if you have done this or not but if uploading a file you have
to set enctype="multipart/form-data" in the form tag
Cheers,
Allen K
[6/8] 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
[7/8] from: webmaster:siliconspecies at: 23-Dec-2000 4:37
DUH!
I have had no luck with getting this to work.
Have you?
Please assist.
decode-multi is not working for me.
http://www.rebol.org/cgi/POST.html
I get odd results if anything.
Even tried looping the read-io function but then all I got was
----------- ------------- ----------- -------------- ---------
---------- ---------- ------------ ---------- -------------
something like that so my assumption is it loops but does not keep reading
new data, only old data
Need to get this working ASAP.
Please help
Thanks,
Jeff
[8/8] from: webmaster:siliconspecies at: 29-Dec-2000 1:45
Happy Holidays!
Eric when you have a chance please post this code.
Thank You.
Jeff
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted