catonthecouchproductions
asked on
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;
}
?>
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;
}
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
If you first use it and then define it then you will get empty in $message.
ASKER
Ahhh...thank you for that! Worked great!
Ryan
Ryan
ASKER
Thanks,
Ryan