[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 218
  • Last Modified:

Not sending file upload URL to email

Hey, I have an email form that someone here at EE helped me out with.

The form:

Sends the form
Includes all data BUT the uploaded files URL
I get no errors.
Image gets uploaded

Link: http://critterclassifieds.net/?a=ad-signup

Any suggestions? So the only thing is the:

$fileHTTPURL

Is not getting printed.

CODE:

<?php

$subject = $_POST['subject'];
$name    = $_POST['name'];
$company = $_POST['company'];
$phone   = $_POST['phone'];;

// Mail of sender
$email   = "$email";
// From
$header  = "from: $name <$email>";

// Enter your email address
$to      = 'glanceatx@gmail.com';
$message = "$name sent you an ad request on your site.\n Their e-mail address was: $email.\n\n Company: $company\n Phone: $phone\n\n File URL : $fileHTTPURL\n";


// START OF IMAGE UPLOAD
$path2Save      = "images/upload/"; // make sure dir exsists
$picFileName    = "$pic_name";
$fileSavedLink  = "$path2Save$picFileName";
$fileHTTPURL    = "http://www.critterclassifieds.net/$fileSavedLink";


if(empty($picFileName)){
      include("http://www.critterclassifieds.net/index.php?a=ad-signup");
        echo('No picture to upload');
      exit;
}
else {

             if(move_uploaded_file ($pic, $fileSavedLink)){
                   header('Location: http://www.critterclassifieds.net/index.php?a=paypalthankyou');
                         // mail coding stat here

                         mail($to,"Ad Sign Up - Request",$message,"From: $email\n");

                         // mail coding end here
             }

             else {
                  echo "Failed to upload file. Please try later";
                  include("form.htm");
             }
             exit;
     }
?>
0
catonthecouchproductions
Asked:
catonthecouchproductions
  • 2
  • 2
1 Solution
 
steelseth12Commented:
<?php

$subject = $_POST['subject'];
$name    = $_POST['name'];
$company = $_POST['company'];
$phone   = $_POST['phone'];;


// START OF IMAGE UPLOAD
$path2Save      = "images/upload/"; // make sure dir exsists
$picFileName    = "$pic_name";
$fileSavedLink  = "$path2Save$picFileName";
$fileHTTPURL    = "http://www.critterclassifieds.net/$fileSavedLink";


// Mail of sender
$email   = "$email";
// From
$header  = "from: $name <$email>";

// Enter your email address
$to      = 'glanceatx@gmail.com';
$message = "$name sent you an ad request on your site.\n Their e-mail address was: $email.\n\n Company: $company\n Phone: $phone\n\n File URL : $fileHTTPURL\n";





if(empty($picFileName)){
      include("http://www.critterclassifieds.net/index.php?a=ad-signup");
        echo('No picture to upload');
      exit;
}
else {

             if(move_uploaded_file ($pic, $fileSavedLink)){
                   header('Location: http://www.critterclassifieds.net/index.php?a=paypalthankyou');
                         // mail coding stat here

                         mail($to,"Ad Sign Up - Request",$message,"From: $email\n");

                         // mail coding end here
             }

             else {
                  echo "Failed to upload file. Please try later";
                  include("form.htm");
             }
             exit;
     }
?>
0
 
catonthecouchproductionsAuthor Commented:
Hey, I am trying to see what you changed but cant..could you explain what you did?

Thanks,
Ryan
0
 
steelseth12Commented:
First you must difine the variable $fileHTTPURL and then use it in $message.

If you first use it and then define it then you will get empty in $message.
0
 
catonthecouchproductionsAuthor Commented:
Ahhh...thank you for that! Worked great!

Ryan
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now