php - dropzone.js how to send me mail after upload is completed -
i've added dropzone.js script site , got working. want email when uploads in dropzone. don't know how in php.
my html:
<form action="dropzone/upload.php" class="dropzone" id="myawesomedropzone"></form>
my upload.php
<?php $ds = directory_separator; $storefolder = 'uploads'; $digits = ''; $amountofdigits = 4; $numbers = range(0,9); shuffle($numbers); for($i = 0;$i < $amountofdigits;$i++) $digits .= $numbers[$i]; if (!empty($_files)) { $tempfile = $_files['file']['tmp_name']; $targetpath = dirname( __file__ ) . $ds . $storefolder . $ds; $targetfile = $targetpath . time() . '-' . $digits . '-' . $_files['file']['name']; move_uploaded_file($tempfile,$targetfile); } ?>
the code above sends files folder want them timestamp no file ever override existing file. when done want email know uploaded file. how can accomplished.
the mailingscript want use:
$message = "bunch of html"; $headers = "mime-version: 1.0\r\n"; $headers.= "content-type: text/html; charset=iso-8859-1\r\n"; $headers.= "from: examle <info@example.com>\r\n"; $subject = "example"; $to = "me@mydomain.com"; mail($to, $subject, $message, $headers)
when changed
move_uploaded_file($tempfile,$targetfile);
into:
if(move_uploaded_file($tempfile,$targetfile) { //my mailingcode here }
it worked wanted.
php dropzone.js
No comments:
Post a Comment