Solved

Uploading File via CGI

Posted on 1997-03-10
1
156 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
ID: 1827643
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this tutorial I will focus on how to use WhizBase as a tool for sending ICQ messages to ICQ. Here I will use a new technology in WhizBase, published in WhizBase 5.1 version. In this tutorial I will use 3 files, pager.wbsp for the processing, e…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

930 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

17 Experts available now in Live!

Get 1:1 Help Now