Solved

Uploading File via CGI

Posted on 1997-03-10
1
170 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

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.
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

630 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