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
IgaelIn reply to Re: Upload file- Ajax+Perl
by Anonymous Monk
in thread Upload file- Ajax+Perl
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |