ibjdt
Programmer
- Nov 25, 2002
- 63
the following code works for a single attachment as defined in the script (Type => 'application/pdf').
however, i would like to allow users to upload an attachement so it will not always be a pdf file.
how can i modify the code to allow multiple attachment types (i can get the path and filename from the upload parameter)?
i haven't tried it, but i believe it would work with a dropdown box for the user to select the file type (pdf, doc, xls, gif, jpg, etc.). the value associated with the selection could be passed to the script.
two issues -
1. it seems cheesy to make the user upload the file and tell me what type it is
2. in the case of jpg - if i use type => image/jpg, would it make a difference if the extension is actually jpeg?
thanks.
Code:
my $msg = MIME::Lite->new(From => email@email.com',
To => email@email.com',
Subject => 'My File Tester',
Type => 'multipart/mixed');
$msg->attach(Type => 'application/pdf',
Path => '../file.pdf',
Filename => file.pdf',
Disposition => 'attachment');
$msg->send( );
however, i would like to allow users to upload an attachement so it will not always be a pdf file.
how can i modify the code to allow multiple attachment types (i can get the path and filename from the upload parameter)?
i haven't tried it, but i believe it would work with a dropdown box for the user to select the file type (pdf, doc, xls, gif, jpg, etc.). the value associated with the selection could be passed to the script.
Code:
<option value="image/jpg">jpg
two issues -
1. it seems cheesy to make the user upload the file and tell me what type it is
2. in the case of jpg - if i use type => image/jpg, would it make a difference if the extension is actually jpeg?
thanks.