når du retter fileAttach til upfile, så ret det alle steder
hvad er meningen med
//copy the temp. uploaded file to uploads folder
$path_of_uploaded_file = $images . $name_of_uploaded_file;
$tmp_path = $_FILES["uploaded_file"]["tmp_name"];
if(is_uploaded_file($tmp_path)){
if(!copy($tmp_path,$path_of_uploaded_file)) {
$errors .= '\n error while copying the uploaded file';
}
}
$path_of_uploaded_file, $images, $name_of_uploaded_file, uploaded_file findes iøvrigt slet ikke.
lavede coden om så jeg sender message for sig selv istedet for en del af header
dette virker hos mig- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title></title>
- <style type="text/css">
- </style>
- <script type="text/javascript">
- </script>
- </head>
- <body>
- <form enctype="multipart/form-data" action="uploader.php" method="post">
- Upload et billede: <input name="upfile" type="file" /><br />
- <div class="input-row"><label for="mail">E-mail: </label><input id="mail" name="mail" type="text" /></div>
- <input type="submit" value="Send" />
- </form>
- </body>
- </html>
- <?php
- //*** Uniqid Session ***//
- $strSid = md5(uniqid(time()));
- $to = $_POST['mail'];
- $from = 'adamkischi@gmail.com'; // min domain mail addresse lavet om til din
-
- $subject = 'the subject';
- $message = 'hello';
-
- $headers = 'From: '.$from. "\r\n" . 'Reply-To: '.$from. "\r\n";
- $headers .= "MIME-Version: 1.0\n";
- $headers .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n";
- $headers .= "This is a multi-part message in MIME format.\n";
- $headers .= "--".$strSid."\n";
- $headers .= "Content-type: text/html; charset=utf-8\n";
- $headers .= "Content-Transfer-Encoding: 7bit\n\n";
-
- if($_FILES["upfile"]["name"] != "") {
- $strFilesName = $_FILES["upfile"]["name"];
- $strContent = chunk_split(base64_encode(file_get_contents($_FILES["upfile"]["tmp_name"])));
- $headers .= "--".$strSid."\n";
- $headers .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"\n";
- $headers .= "Content-Transfer-Encoding: base64\n";
- $headers .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"\n\n";
- $headers .= $strContent."\n\n";
- }
- $flgSend = @mail($to, $subject, $message, $headers); // @ = No Show Error //
- if($flgSend){
- echo "Mail send completed.";
- }
- else{
- echo "Cannot send mail.";
- }
- ?>