Solved

Uploading File via CGI

Posted on 1997-03-10
1
159 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Introduction:   Welcome to my first article ever. To begin with, the reason I write this article.  I participated in a question on Experts Exchange about the start command in Windows and there were some discussion about the usage. The discussio…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

856 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