Skip to content
Advertisement

Send the download link of the uploaded file in a mail

I am using the “jquery file upload plugin” in my website. The plugin give me a feature to download the file after uploaded it, and here’s the code

JavaScript

Now, I need to make user can send email with the downloaded url of the uploaded file, so I used a fancy contact form to send email by each uploaded file, and here’s the code

JavaScript

Also the fancy contact form using a submit.php file to send the mail, and here’s the code

JavaScript

Am trying now to post the download url of the uploaded file in the message of the mail, I tried to add it in ($msg= Download: ‘.$url.’), and I set the ($url = “http://domain.com/files=” .$file_name ; ), but when I received the mail I just received (Download: /file= “without the file name”).

I need to post the full url of the uploaded file in the mail. Any Help???

Advertisement

Answer

in submit.php $url = "http://exemple.com/files=" .$file_name ;

$file_name is undefined; you need to post this data from your form as well.

Answer Part 1: File.URL is not passed, or showed to the user

Assuming that <td class="download"> is in the same page of your form in <td class="mail">

add the value you want to use in your form with an hidden input

JavaScript

in submit.php change

Download: '.$url.'<br />

for

Download: '.$_POST['url'].'<br />

your problem is that in your form you don’t post the related {%=file.url%} data.

Answer Part 2: $emailAddress = ’email@example.com’;

$emailAddress is assigned the string ’email@example.com’ overwrite the value of $emailAddress with $_POST[’email’]. (in this example i overwrite the value of $url and create a variable $usrname and assign them the $_POST equivalent )

Replace

JavaScript

With this

JavaScript
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement