in reply to Upload file- Ajax+Perl
for ajax file upload : keep in mind that you can get your file by reading STDIN ( without calling CGI , don't include it ). Send the other informations as HTTP headers.
my $fn = (exists $ENV{'HTTP_X_FILENAME'} ? $ENV{'HTTP_X_FILENAME'} + : "" ); my $rep = (exists $ENV{'HTTP_X_REP'} ? $ENV{'HTTP_X_REP'} : "" ); print "Content-type: text/html; charset=utf-8\r\n\r\n" ; my $repTmp = "/tmp/" ; my $fichier = "$repTmp/$fn" ; my $len = 0 ; if( open ( UPLOADFILE, ">$fichier" ) ) { binmode UPLOADFILE; while( <STDIN> ) { print UPLOADFILE $_ ; $len += length($_); } close UPLOADFILE ; } # an internal function to verify the file and to move it fais_copy($repTmp , $fn,$rep,1,0); print "ok $rep$fn de $len octets\n" ;
For multiple files, an AJAX post makes several calls to the same cgi. Then it is ok.
I made this tiny script to handle the filedrag.js by Craig Buckler (@craigbuckler) of OptimalWorks.net instead using php
Igael
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Upload file- Ajax+Perl
by Anonymous Monk on Jan 30, 2014 at 00:01 UTC | |
|
Re^2: Upload file- Ajax+Perl
by Anonymous Monk on Jul 10, 2016 at 15:14 UTC | |
by Anonymous Monk on Jul 10, 2016 at 20:19 UTC | |
by romanegloo (Initiate) on Jul 12, 2016 at 18:03 UTC |