mcneil
asked on
Auto sending a file as an attachment to an email
Hi all,
What I need to do is get my hands on some kind of cgi script that allows a user to send themselves a file by clicking a link... I know it's a little obscure... why not just download it? But hey, it's what the client wants.
I've seen this on another site, and it's done with a call to a cgi.
Thanks all,
mcneil
What I need to do is get my hands on some kind of cgi script that allows a user to send themselves a file by clicking a link... I know it's a little obscure... why not just download it? But hey, it's what the client wants.
I've seen this on another site, and it's done with a call to a cgi.
Thanks all,
mcneil
hualian,
you are using base64 encoding to send the file across.
but you need to realize that the end user/recipient must know how to use their email client to decode, using base 64, & then extract the file.
i know a vast majority of users (technical & non-technical) find it very difficult to do that!!.
i hope you have taken that into consideration in your solution.
you are using base64 encoding to send the file across.
but you need to realize that the end user/recipient must know how to use their email client to decode, using base 64, & then extract the file.
i know a vast majority of users (technical & non-technical) find it very difficult to do that!!.
i hope you have taken that into consideration in your solution.
ASKER
Sorry, guess I'm a little confused, or I wasn't clear enough. What I'm looking to do is have a link on the web page that a person can click to email themselves a file. This is done in two stages. First the user clicks the appropriate file, and then gets a second page asking where he wants it sent to.
To see this in action, go to:http://www.national.com/pf/LM/LMV102.html#Datasheet and try clicking the "Recieve via email." You'll see what I mean.
I guess I'm hoping for a simple "prepackaged" cgi I can use to acheive this, as I've got little to no skills in that area.
Thanks for all your help.
mcneil
To see this in action, go to:http://www.national.com/pf/LM/LMV102.html#Datasheet and try clicking the "Recieve via email." You'll see what I mean.
I guess I'm hoping for a simple "prepackaged" cgi I can use to acheive this, as I've got little to no skills in that area.
Thanks for all your help.
mcneil
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
1. you can use redirect method.
print "Location: somefile\n\n";
2. you need use encode the file and make a mail file like:
--bbtieappiqmaklud
Content-Type: application/octet-stream; name="5-67news.zip"
Content-Disposition: attachment; filename="youfile.zip"
Content-Transfer-Encoding:
UEsDBBQAAAAIAC2Ipyg4O0zCcq
mSeKv1eV/gfXqdqqpGrS093pTj
899QtGWJkmVeABAgCN4AEiBAEC
0k2RwPfyfJ/77XvHzxT79epoXR
--bbtieappiqmaklud--
how to encode base64:
follow is perl sub for encode base 64
sub encode_base64 ($;$) {
my $res = "";
my $eol = $_[1];
$eol = "\n" unless defined $eol;
pos($_[0]) = 0; # ensure start at the beginning
while ($_[0] =~ /(.{1,45})/gs) {
$res .= substr(pack('u', $1), 1);
chop($res);
}
$res =~ tr|` -_|AA-Za-z0-9+/|; # `# help emacs
# fix padding at the end
my $padding = (3 - length($_[0]) % 3) % 3;
$res =~ s/.{$padding}$/'=' x $padding/e if $padding;
# break encoded string into lines of no more than 76 characters each
if (length $eol) {
$res =~ s/(.{1,76})/$1$eol/g;
}
$res;
}
if you still have problem,please say.