[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [PERL] file upload?



sslug@sslug wrote:

> Har nogen set et dette? Et eksempel?

  ------------------------------------------------------------------------

#!/usr/bin/perl -w
use CGI;

my $query = new CGI;
my $file = $query->param('file');
my $myFile = "/tmp/test1.file"
open(FILE, ">$myFile");
while (read($file, $buffer, 1024)) { print FILE $buffer; };
close (FILE);

print "Content-type: text/html\n\n";
print "File is uploaded to $myFile";
exit(0);
  ------------------------------------------------------------------------

Det antages at du i din form har et felt der ser således ud: <input type=file
name=file>
Det kan sikkert gøre mere elegant, men dette virker og er ret nemt. I
"perldoc CGI" kan du finde mere hjælp - blandt andet om hvordan du kan finde
det originale filnavn, etc.

// Flemming
--
Flemming Mahler Larsen, Tele Danmark Internet
http://projekt.tele.dk.net/about/mahler.html // +45 3917 9013



 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 19:52 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *