Jump to content

Uploaded file URL in post results sent to e-mail


JCS1988

Recommended Posts

Hello, I received some great help on this forum a few weeks ago and have another question and decided to come back. I have a form that collects information from the user and also allows them to upload a image, the form then sends the results to a handler on a separate PHP page, that page then sends the information I want to my e-mail address. Everything works great and the uploads to my server with no problems, but the only thing I would like to know is how do I get the link to the uploaded image sent in the e-mail results so I could just click it and see the image uploaded. My handler is attached, if you need any other code let me know. Thanks.

 

<?php
  if (sizeof($_POST)==0)
{
header("Location:quote.php");
}
else
{

$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

mail("jessesimmers@gmail.com","Price Quote Request","Form data:

First Name: " . $_POST['field_1'] . " 
Last Name: " . $_POST['field_2'] . " 
E-Mail Address: " . $_POST['field_3'] . " 
Phone Number: " . $_POST['field_4'] . "
Type of Shirt: " . $_POST['field_5'] . "
Shirt Color: " . $_POST['field_6'] . "
Front Colors: " . $_POST['field_16'] . "
Back Colors: " . $_POST['field_17'] . "
X Small: " . $_POST['field_7'] . "
Small: " . $_POST['field_8'] . "
Medium: " . $_POST['field_9'] . "
Large: " . $_POST['field_10'] . "
X Large: " . $_POST['field_11'] . "
XX Large: " . $_POST['field_12'] . "
3XL: " . $_POST['field_13'] . "
4XL: " . $_POST['field_14'] . "
5XL: " . $_POST['field_15'] . "
How did you hear about us?: " . $_POST['field_18'] . "
If other, type here: " . $_POST['field_19'] . "
Comments/Description: " . $_POST['field_20'] . "

","From: PriceQuoteRequest@elitescreenprintingpa.com");
}

  ?>
<?php

$where_form_is="http://".$_SERVER['SERVER_NAME'].strrev(strstr(strrev($_SERVER['PHP_SELF']),"/"));

// File upload handling
if($_FILES['field_21']['name']!=''){
$field_21_filename = "file_21_".date("sihdmY").substr($_FILES['field_21']['name'],strlen($_FILES['field_21']['name'])-4);
if(!move_uploaded_file($_FILES['field_21']['tmp_name'], "./php_uploads/".$field_21_filename)){
die("File " .  $_FILES['field_21']['name'] . " was not uploaded.");
}
}

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.