🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.web
Article #1014

Re: CGI how to write program for accepting file uploaded to server

#1014
From: Hans Galema
Date: Sun, 23 Oct 2005 10:39
25 lines
1985 bytes
zhangsn wrote:
> "<form enctype="multipart/form-data"
> action="http://192.168.29.65/UploadFile" method=post>

Is receiving an uploaded file the only thing your cgiprogram
should do ? I like to know if you already know how to handle
GET requests (with QUERY_STRING) and POST requests (CONTENT_LENGTH
and readig from STDIN).

For your uploaded file you read the contents from STDIN because
the REQUEST_METHOD POST is used. There are also all kinds of
headers to be read from STDIN first.

You will see things like:
     Content-Disposition: form-data; name="userfile4"; filename="e:\a2x.txt"
     Content-Type: text/plain

Sadly enough you have to check Content-Type: as the protocol/coding
is different for different types of files.

Please tell more about what you already know and show the
code where you tried to handle the upload and tell what kind of
difficulties you encountered.

Hans.
Technical Details
Message-ID: <435b67d8$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newshub.sdsu.edu!peer01.west.cox.net!cox.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <435a2142@newsgroups.borland.com> <435a3d89@newsgroups.borland.com> <435a4548$1@newsgroups.borland.com> <435ad565@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: feeec,943780c8a609b3ea
X-Google-Attributes: gidfeeec,public
X-Google-Language: ENGLISH,ASCII-7-bit
Date: Sun, 23 Oct 2005 12:39:00 +0200
From: Hans Galema <notused@notused.nl>
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
X-Accept-Language: en-us, en
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.internet.web
Subject: Re: CGI how to write program for accepting  file uploaded to server
References: <435a2142@newsgroups.borland.com> <435a3d89@newsgroups.borland.com> <435a4548$1@newsgroups.borland.com> <435ad565@newsgroups.borland.com>
In-Reply-To: <435ad565@newsgroups.borland.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 145.98.201.248
Message-ID: <435b67d8$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1130063832 145.98.201.248 (23 Oct 2005 03:37:12 -0700)
Lines: 25
Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!newshub.sdsu.edu!peer01.west.cox.net!cox.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail