🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#1020
From: Hans Galema
Date: Tue, 25 Oct 2005 14:41
28 lines
2110 bytes
zhangsn wrote:

> if(getenv("Content-Length"))
> n=atoi(getenv("Content-Length"));

     if(getenv("CONTENT_LENGTH"))
	n=atoi(getenv("CONTENT_LENGTH"));

and/or

     if ( getenv ( "CONTENT_LENGTH" ) )
	printf ( "CONTENT_LENGTH: %s<br>\n", getenv ( "CONTENT_LENGTH" )  );


> My html code:

Your html source has nothing to do with fileupload.
It looks as if these are your first steps with cgi programming in c.
Your example html page will produce key=value pairs. Before
being able to use them you will have to url_decode all data read
from stdin. That is because the browser url_encoded al data before
sending it to the webserver.

>>Please trim quotes.

You did not do that. Please do not send back a complete message.

Hans.
Technical Details
Message-ID: <435e43c2$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!fr.ip.ndsoftware.net!213.239.142.2.MISMATCH!feeder.xsnews.nl!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <435a2142@newsgroups.borland.com> <435a3d89@newsgroups.borland.com> <435a4548$1@newsgroups.borland.com> <435ad565@newsgroups.borland.com> <435b67d8$1@newsgroups.borland.com> <435b780e@newsgroups.borland.com> <435b9697@newsgroups.borland.com> <435e3d3b$3@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: Tue, 25 Oct 2005 16:41:53 +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> <435b67d8$1@newsgroups.borland.com> <435b780e@newsgroups.borland.com> <435b9697@newsgroups.borland.com> <435e3d3b$3@newsgroups.borland.com>
In-Reply-To: <435e3d3b$3@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: <435e43c2$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1130251202 145.98.201.248 (25 Oct 2005 07:40:02 -0700)
Lines: 28
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!fr.ip.ndsoftware.net!213.239.142.2.MISMATCH!feeder.xsnews.nl!feeder.enertel.nl!nntpfeed-01.ops.asmr-01.energis-idc.net!news-out.newsfeeds.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail