Solved

Uploading File via CGI

Posted on 1997-03-10
1
155 Views
Last Modified: 2013-12-25
Hi, I want to enable the visitor of my website to upload files. Therefore, I've got a form with a TYPE="FILE" field.
But I don't know the parameters of the field, nor do I know
what my CGI-script has to look like if the file being uploaded should be stored somewhere on the server.
0
Comment
Question by:vanbasco
1 Comment
 
LVL 1

Accepted Solution

by:
Kallisti earned 50 total points
Comment Utility
I had never heard of the tag you used before, and was quite
shocked when testing it and reading up on it to find that
it actually existed!

Anyway, to answer the question, it should be used as follows:

<FORM       ENCTYPE="multipart/form-data"
      ACTION="antest.cgi"
      METHOD=POST>
<INPUT TYPE="file" name="afile"><BR>
<INPUT TYPE="submit">
</FORM>

And the cgi script is simply passwd a multipart-mime
file in its STDIN.  an example of just getting this
and displaying it (which will almost ALWAYS look
messy) is:

#!/usr/bin/perl

read(STDIN, $incoming, $ENV{'CONTENT_LENGTH'});

print "Content-Type: text/html\n\n";

print "$incoming\n";


Hope this helps, and good luck...
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now