Note that there are some explanatory texts on larger screens.

plurals
  1. POConverting a html generating php script into a automatic email script
    primarykey
    data
    text
    <p>I got this script for creating an HTML page from an image uploader, The only problem is that it overwrite's itself on every upload, I would like to change it so that I get sent an e-mail instead.</p> <p>Ideas? </p> <pre><code> &lt;?php $destination_dir = "uploaded/"; $targetPath = dirname($_SERVER['SCRIPT_URI']) . "/"; $html_start = " &lt;!doctype html public \"-//w3c//dtd html 4.0 transitional//en\"&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"&gt; &lt;title&gt;Upload results&lt;/title&gt; &lt;/head&gt; &lt;body&gt; "; $html_end = " &lt;/body&gt; &lt;/html&gt; "; // Check if there are AdditionalStringVariable $result = "AdditionalStringVariable: " . $_POST["AdditionalStringVariable"]; $result .= "&lt;br&gt;"; // Process value of QIU_thumbnails_Imagedata field, this is JPEG-files array of generated thumbnails if($_FILES[QIU_thumbnails_Imagedata]) { foreach ($_FILES[QIU_thumbnails_Imagedata][name] as $key =&gt; $value) { $uploadfile = $destination_dir . basename($_FILES[QIU_thumbnails_Imagedata][name][$key]); if (move_uploaded_file($_FILES['QIU_thumbnails_Imagedata']['tmp_name'][$key], $uploadfile)) { $big_image_name = $_FILES[Imagedata][name][$key]; $result .= "&lt;a href='" .$big_image_name. "'&gt;" . "&lt;img border = '0' src='".$value . "'/&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;"; } } } // $result .= "&lt;br&gt;"; // Process value of Imagedata field, this is JPEG-files array foreach ($_FILES[Imagedata][name] as $key =&gt; $value) { $uploadfile = $destination_dir . basename($_FILES[Imagedata][name][$key]); if (move_uploaded_file($_FILES['Imagedata']['tmp_name'][$key], $uploadfile)) { $result .= "File uploaded: &lt;a href='". $value . "'&gt;" . $value . "&lt;/a&gt;&lt;br&gt;"; } } // $result .= "&lt;br&gt;"; // // Process GlobalControlData field, this is the array of serialized data for Global controls // the value for each control is: id|value if($_POST[GlobalControlData]) { foreach ($_POST[GlobalControlData] as $key =&gt; $value) { $globalControlExploded = explode("|", $value); $result .= "\n" . "GlobalControlData:\n\t" . $globalControlExploded[0] ."\t:\t" . $globalControlExploded[1] . "&lt;br&gt;"; } } // // Process LocalControlData field, this is the array of serialized data for Local controls // value for each image is: image||id1|value1^id2|value2^id3|value3, where image - is picture name, id - is unique control ID , and a value - control value if($_POST[LocalControlData]) { foreach ($_POST[LocalControlData] as $key =&gt; $value) { $exploded = explode("||", $value); $parentFile = $exploded[0]; $result .= "&lt;br&gt;" . $exploded[0] . "&lt;br&gt;"; $explodedToControls = explode("^", $exploded[1]); foreach ($explodedToControls as $cnt =&gt; $val) { $eachControl = explode("|", $val); $result .= "\tcontrol:\t" . $eachControl[0] . ", value:\t" . $eachControl[1] . "&lt;br&gt;"; } // } } // $result = $html_start . $result . $html_end; // if(@$fp = fopen($destination_dir.'index.html', 'w')) { fwrite($fp, $result); fclose($fp); } 132 echo $targetPath . $destination_dir; 133 134 ?&gt; </code></pre> <p>I just added this:</p> <pre><code>135 136 $to = 'michael.robinson@mac.com'; 137 $subject = 'Baublet Order Received'; 138 $headers = 'From: orders@baublet.com '. "\r\n" . 139 'MIME-Version: 1.0' . "\r\n" . 140 'Content-type: text/html; charset=utf-8' . "\r\n"; 141 mail($to, $subject, $result, $headers"); 142 143 ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload