Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8686343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:49:20+00:00 2026-06-12T22:49:20+00:00

I am using the jquery file upload plugin in my website. The plugin give

  • 0

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

<td class="download">
                <a href="{%=file.url%}" class="btn modal-download" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}">
                <i class="icon-download"></i>
                Download</a>
            </td>

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

<td class="mail">
                <div id="form-container">
    <h1>Fancy Contact Form</h1>
    <h2>Drop us a line and we will get back to you</h2>

    <form id="contact-form" name="contact-form" method="post" action="fancymail/submit.php">
      <table width="100%" border="0" cellspacing="0" cellpadding="5">
        <tr>
          <td width="15%"><label for="name">Name</label></td>
          <td width="70%"><input type="text" class="validate[required,custom[onlyLetter]]" name="name" id="name" value="<?=$_SESSION['post']['name']?>" /></td>
          <td width="15%" id="errOffset">&nbsp;</td>
        </tr>
        <tr>
          <td><label for="email">Email</label></td>
          <td><input type="text" class="validate[required,custom[email]]" name="email" id="email" value="<?=$_SESSION['post']['email']?>" /></td>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td><label for="subject">Subject</label></td>
          <td width="70%"><input type="text" class="validate[required,custom[onlyLetter]]" name="subject" id="subject" value="<?=$_SESSION['post']['subject']?>" /></td>
          <!--<td><select name="subject" id="subject">
            <option value="" selected="selected"> - Choose -</option>
            <option value="Question">Question</option>
            <option value="Business proposal">Business proposal</option>
            <option value="Advertisement">Advertising</option>
            <option value="Complaint">Complaint</option>
          </select>          </td>-->
          <td>&nbsp;</td>
        </tr>
        <tr>
          <td valign="top"><label for="message">Message</label></td>
          <td><textarea name="message" id="message" class="validate[required]" cols="35" rows="5"><?=$_SESSION['post']['message'] ?></textarea></td>
          <!--efoula-->

          <!--efoula-->
          <td valign="top">&nbsp;</td>
        </tr>
        <tr>
          <td><label for="captcha"><?=$_SESSION['n1']?> + <?=$_SESSION['n2']?> =</label></td>
          <td><input type="text" class="validate[required,custom[onlyNumber]]" name="captcha" id="captcha" /></td>
          <td valign="top">&nbsp;</td>
        </tr>
        <tr>
          <td valign="top">&nbsp;</td>
          <td colspan="2"><input type="submit" name="button" id="button" value="Submit" />
          <input type="reset" name="button2" id="button2" value="Reset" />

          <?=$str?>          <img id="loading" src="img/ajax-load.gif" width="16" height="16" alt="loading" /></td>
        </tr>
      </table>
      </form>
      <?=$success?>
    </div>
            </td>

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

<?php

/* config start */

$emailAddress = 'email@example.com';

/* config end */
$url = "http://domain.com/files=" .$file_name ;


require "phpmailer/class.phpmailer.php";
require "../server/php/upload.class.php";

session_name("fancyform");
session_start();


foreach($_POST as $k=>$v)
{
    if(ini_get('magic_quotes_gpc'))
    $_POST[$k]=stripslashes($_POST[$k]);

    $_POST[$k]=htmlspecialchars(strip_tags($_POST[$k]));
}


$err = array();

if(!checkLen('name'))
    $err[]='The name field is too short or empty!';

if(!checkLen('email'))
    $err[]='The email field is too short or empty!';
else if(!checkEmail($_POST['email']))
    $err[]='Your email is not valid!';

if(!checkLen('subject'))
    $err[]='You have not selected a subject!';

if(!checkLen('message'))
    $err[]='The message field is too short or empty!';

if((int)$_POST['captcha'] != $_SESSION['expect'])
    $err[]='The captcha code is wrong!';


if(count($err))
{
    if($_POST['ajax'])
    {
        echo '-1';
    }

    else if($_SERVER['HTTP_REFERER'])
    {
        $_SESSION['errStr'] = implode('<br />',$err);
        $_SESSION['post']=$_POST;

        header('Location: '.$_SERVER['HTTP_REFERER']);
    }

    exit;
}


$msg=
'Name:  '.$_POST['name'].'<br />
Email:  '.$_POST['email'].'<br />
Download: '.$url.'<br />


Message:<br /><br />

'.nl2br($_POST['message']).'

';


$mail = new PHPMailer();
$mail->IsMail();

$mail->AddReplyTo($_POST['email'], $_POST['name']);
$mail->AddAddress($emailAddress);
$mail->SetFrom($_POST['email'], $_POST['name']);
$mail->Subject = "A new ".mb_strtolower($_POST['subject'])." from ".$_POST['name']." | contact form feedback";

$mail->MsgHTML($msg);

$mail->Send();


unset($_SESSION['post']);

if($_POST['ajax'])
{
    echo '1';
}
else
{
    $_SESSION['sent']=1;

    if($_SERVER['HTTP_REFERER'])
        header('Location: '.$_SERVER['HTTP_REFERER']);

    exit;
}

function checkLen($str,$len=2)
{
    return isset($_POST[$str]) && mb_strlen(strip_tags($_POST[$str]),"utf-8") > $len;
}

function checkEmail($str)
{
    return preg_match("/^[\.A-z0-9_\-\+]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $str);
}

?>

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=&#8221; .$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???

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T22:49:22+00:00Added an answer on June 12, 2026 at 10:49 pm

    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

     <input type="hidden" name="url" value="{%=file.url%}" />
    

    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

    $msg=
    'Name:  '.$_POST['name'].'<br />
    Email:  '.$_POST['email'].'<br />
    Download: '.$url.'<br />
    
    
    Message:<br /><br />
    
    '.nl2br($_POST['message']).'
    
    ';
    

    With this

    $usrname = $_POST['name'];
    $emailAddress = $_POST['email'];
    $url = $_POST['url'];
    
    $msg=
    'Name:  '.$usrname.'<br />
    Email:  '.$emailAddress.'<br />
    Download: '.$url.'<br />
    
    
    Message:<br /><br />
    
    '.nl2br($_POST['message']).'
    
    ';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using the jQuery multi-file upload plugin found here: http://www.fyneworks.com/jquery/multiple-file-upload/ I don't see in
I am using the Blueimp Jquery file upload plugin on my website, and I
I am using Uploadify jQuery plugin for file upload.Here there is no browse button
I am using Valum file upload plugin in my website as well as jquery-ui
I'm using the jQuery File Upload plugin (documentation here ) integrated into my Rails
I am currently using Valums JQuery File Upload plugin. The plugin is very convenient
i am using jquery form plugin for file upload . i am not able
I'm using a plugin from jquery to use a multiple file upload to create
I am using the following jquery file upload plugin to display progress bars when
I am using the multi-upload plugin found at: http://www.fyneworks.com/jquery/multiple-file-upload/ This is what I am

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.