View previous topic :: View next topic |
Author |
Message |
theguy0000 -
Joined: 25 Apr 2007 Posts: 8
|
Posted: Wed Apr 25, 2007 12:06 am Post subject: Uploads in cgi |
|
|
I'm using a seperate language (one meant for applications, not originally meant for web stuff) to use CGI.
So far, I can echo, retrieve post, get, and cookies, handle forms, all the basics.
Now, using the standard CGI protocol, how can I get what is needed to upload files?
Using this html:
Code: | <form enctype="multipart/form-data" action="upload.auw" method="POST"> Please choose a file: <input name="uploaded" type="file" />
<input type="submit" value="Upload" /> </form> |
how is it possible with cgi? in php, you use the $_FILES variable. How do I retrieve that same data? _________________ hellooooooooo! |
|
Back to top |
|
|
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Wed Apr 25, 2007 4:40 am Post subject: |
|
|
Maybe if you tell us what new language you're using, we can know the syntax so that we may help you. |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Wed Apr 25, 2007 6:25 pm Post subject: Re: Uploads in cgi |
|
|
theguy0000,
What that language? Are you coding CGI stuff by hand without using a library? _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
theguy0000 -
Joined: 25 Apr 2007 Posts: 8
|
Posted: Wed Apr 25, 2007 11:37 pm Post subject: Re: Uploads in cgi |
|
|
aprelium wrote: | theguy0000,
What that language? Are you coding CGI stuff by hand without using a library? |
I have created a library. The language is called AutoIt.
Here is a link to the library I am currently using:
http://www.autoitscript.com/forum/index.php?showtopic=30564
(it's that scrollable block of code in the first post) _________________ hellooooooooo! |
|
Back to top |
|
|
theguy0000 -
Joined: 25 Apr 2007 Posts: 8
|
Posted: Fri May 04, 2007 5:03 am Post subject: |
|
|
uh, hello? _________________ hellooooooooo! |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Fri May 04, 2007 11:36 pm Post subject: |
|
|
theguy0000,
Sorry for the delay to get back to you. We recommend reading RFC 1867 ( http://www.ietf.org/rfc/rfc1867.txt ) which is the official standard related to the file uploads protocol.
In CGI, the uploaded payload will be available by reading CONTENT_LENGTH bytes from the standard input. You'll have then to decode the read data according to the RFC 1867 guidelines (split them in several chunks around the boundaries, decode the headers of each chunk, and get the file data out of it).
If you need more technical details, please do not hesitate to send us your questions. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
theguy0000 -
Joined: 25 Apr 2007 Posts: 8
|
Posted: Sat May 05, 2007 1:58 pm Post subject: |
|
|
aprelium wrote: | theguy0000,
Sorry for the delay to get back to you. We recommend reading RFC 1867 ( http://www.ietf.org/rfc/rfc1867.txt ) which is the official standard related to the file uploads protocol.
In CGI, the uploaded payload will be available by reading CONTENT_LENGTH bytes from the standard input. You'll have then to decode the read data according to the RFC 1867 guidelines (split them in several chunks around the boundaries, decode the headers of each chunk, and get the file data out of it).
If you need more technical details, please do not hesitate to send us your questions. |
Now that's the kind of answer I was looking for! :D :D
Much appreciation,
Matt _________________ hellooooooooo! |
|
Back to top |
|
|
theguy0000 -
Joined: 25 Apr 2007 Posts: 8
|
Posted: Sat May 05, 2007 3:24 pm Post subject: |
|
|
OK, new question.
I have created a form:
Code: | <FORM ACTION="upload.auw" ENCTYPE="multipart/form-data" METHOD=POST>
What is your name? <INPUT TYPE=TEXT NAME=submitter>
What files are you sending? <INPUT TYPE=FILE NAME=cool>
Anything else? <INPUT TYPE=FILE NAME=file>
<br />
<input type="Submit" value="GO!!!!!!!!!!!!!!!!!!!!">
</FORM> |
I upload two files: hello.txt and test.txt. I get this:
Code: | -----------------------------25234242276359
Content-Disposition: form-data; name="submitter"
Matt
-----------------------------25234242276359
Content-Disposition: form-data; name="cool"; filename="hello.txt"
Content-Type: text/plain
I am a cool text file. Worship me.
And I am line two.
and line 3.....
ah! blank line!coolioum
-----------------------------25234242276359
Content-Disposition: form-data; name="file"; filename="test.txt"
Content-Type: text/plain
I am a cool text file. Worship me.
-----------------------------25234242276359--
|
My questions are these:
what is the meaning of the numbers at the end of each divider?
Why is there an extra divider at the end, that shows up when I upload text files, but not when I upload jpeg files? _________________ hellooooooooo! |
|
Back to top |
|
|
theguy0000 -
Joined: 25 Apr 2007 Posts: 8
|
Posted: Sat May 05, 2007 5:41 pm Post subject: |
|
|
Nevermind, I got it working perfectly. Thank you so much! _________________ hellooooooooo! |
|
Back to top |
|
|
aprelium -
Joined: 22 Mar 2002 Posts: 6800
|
Posted: Mon May 07, 2007 8:56 am Post subject: |
|
|
theguy0000 wrote: | Nevermind, I got it working perfectly. Thank you so much! |
You're welcome. _________________ Support Team
Aprelium - http://www.aprelium.com |
|
Back to top |
|
|
|