XUpload - Adding a direct download link to confirmation email messages

Message
Author
INTERNOZEROUNO
Posts: 8
Joined: Mar 23, 2011 7:20 pm

Adding a direct download link to confirmation email messages

#1 Postby INTERNOZEROUNO » Mar 23, 2011 7:30 pm

Hi, recently I bought the last version of this script and think it's very useful. I'd like to put a link in confirmation email in order to let people download the file directly, but don't know how to create it. Every uploaded file shoud have that link in addition to the other parameters like name, size, status...

I tried so many ways, but I am not a skilled programmer and need some help, please. Tell me everything like you're talking to a 6 y.o. child. I don't need to understand, just make it work.

admin
Site Admin
Posts: 1839
Joined: Mar 22, 2006 12:32 pm

#2 Postby admin » Mar 24, 2011 7:03 am

We would never try to teach 6 y.o child programming.
You'd better hire programmer to do that.

INTERNOZEROUNO
Posts: 8
Joined: Mar 23, 2011 7:20 pm

#3 Postby INTERNOZEROUNO » Mar 24, 2011 9:34 am

admin wrote:We would never try to teach 6 y.o child programming.
You'd better hire programmer to do that.
C'mon dude, that was just a way of saying, obviously I meant "use simple words and be as clear as possible", 'cause I'm not a professionist of perl programming, and English is not my first language. Do you take everything so literally?!

Anyway I found out the solution by myself and now I am pridely going to tell you what you have to do in case you are 6 y.o. and reading this thread looking for help.

1. Open XUploadConfig.pm and choose a "uploads" dir outside from cgi-bin folder, like this example:

Code: Select all

# Directory for uploaded files
target_dir      => '/web/htdocs/www.your-site-name.com/home/uploads/',
2. Create "uploads" folder in your site's root with 777 permissions.

3. Open upload.cgi and find this code:

Code: Select all

   my $fhash;
   $fhash->{field_name}=$k;
   $fhash->{file_name_orig} = $filename;
   $fhash->{file_descr} = $cg->param("$k\_descr");
   $fhash->{file_mime}  = $cg->uploadInfo($u)->{'Content-Type'}; 
Edit this way:

Code: Select all

   my $fhash;
   $fhash->{field_name}=$k;
   $fhash->{file_link}=$ext_folder."/";
   $fhash->{file_name_orig} = $filename;
   $fhash->{file_descr} = $cg->param("$k\_descr");
   $fhash->{file_mime}  = $cg->uploadInfo($u)->{'Content-Type'}; 
Find this:

Code: Select all

   my @file_fields = qw(file_name file_name_orig file_status file_size file_descr file_mime);
Edit in:

Code: Select all

   my @file_fields = qw(file_link file_name file_name_orig file_status file_size file_descr file_mime);
Save.

4. Open confirm_email.html and add this code inside the file details table, where you want to see the download link:

Code: Select all

<TR><TD><b>DOWNLOAD:</b></TD><TD><b><a href="http://www.your-site-name.com/uploads/<TMPL_VAR file_link><TMPL_VAR file_name>">http://www.your-site-name.com/uploads/<TMPL_VAR file_link><TMPL_VAR file_name></a></b></TD></TR>
Save.

Note: this solution works with ext_folder and even if your files go directly into "uploads" folder!

Hope it's useful for someone. Good luck! Ciao!
Last edited by INTERNOZEROUNO on Mar 25, 2011 7:06 pm, edited 1 time in total.

admin
Site Admin
Posts: 1839
Joined: Mar 22, 2006 12:32 pm

#4 Postby admin » Mar 24, 2011 11:08 am

Congratulations!