I have a working cgi that allows registered users to upload files (one at a time) however, due to demands from the same users - I need to add multiple upload fi
elds to this
this is my form
and in my cgi - (I have only posted the necessary parts, otherwise its a little long) this:
Am I screwing up on the ($filename) and the ($upload_filehandle)?? Should i have them in some kind of array? to match the form field Names?
or am I totally off base?? or kinda whacked out......
elds to this
this is my form
Code:
<FORM ACTION="uploadmax.cgi" METHOD="post" ENCTYPE="multipart/form-data">
<div align="center" class="style1">
<div align="center">File 1 to Upload:
<INPUT TYPE="file" NAME="photo">
<br>
<br>
File 2 to Upload:
<INPUT TYPE="file" NAME="photo1">
<br>
<br>
File 3 to Upload:
<INPUT TYPE="file" NAME="photo2">
<br>
<br>
File 4 to Upload:
<INPUT TYPE="file" NAME="photo3">
<br>
<br>
File 5 to Upload:
<INPUT TYPE="file" NAME="photo4">
<br>
<br>
File 6 to Upload:
<INPUT TYPE="file" NAME="photo5">
<br>
<br>
Your Email Address:
<INPUT TYPE="text" NAME="email_address">
<br>
<INPUT TYPE="submit" NAME="Submit" VALUE="Upload File">
</div>
</div>
</FORM>
and in my cgi - (I have only posted the necessary parts, otherwise its a little long) this:
Code:
use CGI;
$upload_dir = "/home/httpd/mysite.com/uploadedfiles/";
$http_upload_dir = "[URL unfurl="true"]http://www.mysite.com/uploadedfiles";[/URL]
$query = new CGI;
$filename = $query->param("photo");
$email_address = $query->param("email_address");
$filename =~ s/.*[\/\\](.*)/$6/;
$upload_filehandle = $query->upload("photo");
open UPLOADFILE, ">$upload_dir/$filename";
while ( <$upload_filehandle> )
{
print UPLOADFILE;
}
close UPLOADFILE;
$sendmail = '/usr/lib/sendmail -t';
open MAIL, "|$sendmail";
print MAIL "To: me\@mysite.com\r\n";
print MAIL "From: website\r\n";
print MAIL "Subject: New file uploaded/posted\r\n\r\n";
print MAIL "A new file was uploaded to the FTP area\r\rfrom $email_address\n\rThe Filename is: $filename\r\n\r Open/Download the file from here:\n\r\n img src='$http_upload_dir/$filename'";
close MAIL;
Am I screwing up on the ($filename) and the ($upload_filehandle)?? Should i have them in some kind of array? to match the form field Names?
or am I totally off base?? or kinda whacked out......