| | |
Serious problem with attchments-please help
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2008
Posts: 154
Reputation:
Solved Threads: 19
•
•
•
•
The full file system is the way the folders are structured in the site ?
PHP Syntax (Toggle Plain Text)
<?php echo $_SERVER['DOCUMENT_ROOT']; ?>
That will give the full file system path to your main directory.
Matti Ressler
Suomedia
If you want your dreams to come true, the first thing you must do is to wake up....
Suomedia - Dynamic Content Management
Suomedia - Dynamic Content Management
•
•
Join Date: Mar 2008
Posts: 154
Reputation:
Solved Threads: 19
On some web servers you can set permissions using your FTP client. In most you can right click the file or directory and chosse to set permissions. I use Filezilla and it has "file attributes" in the right click menu.
Alternatively, in your web hosting control panel you should have a file manager. Please consult the documentation for your hosting on how to set file and directory permissions.
If you are on a Windows server, I know absolutely nothing
Matti Ressler
Suomedia
Alternatively, in your web hosting control panel you should have a file manager. Please consult the documentation for your hosting on how to set file and directory permissions.
If you are on a Windows server, I know absolutely nothing
Matti Ressler
Suomedia
If you want your dreams to come true, the first thing you must do is to wake up....
Suomedia - Dynamic Content Management
Suomedia - Dynamic Content Management
•
•
Join Date: Mar 2008
Posts: 154
Reputation:
Solved Threads: 19
The image(s) must be attached to the mail in the way that I showed you. Exactly where on the server the file is moved to is up to you. It actually is normally uploaded to /tmp/ and must be moved from there to a directory within your webspace. This is done with move_uploaded_file() that you see in my script.
If you are attaching mutiple images, you can use a loop rather than repeating the same code multiple times.
Matti Ressler
Suomedia
If you are attaching mutiple images, you can use a loop rather than repeating the same code multiple times.
Matti Ressler
Suomedia
If you want your dreams to come true, the first thing you must do is to wake up....
Suomedia - Dynamic Content Management
Suomedia - Dynamic Content Management
•
•
Join Date: Mar 2008
Posts: 154
Reputation:
Solved Threads: 19
Yes. This should work:
Matti Ressler
Suomedia
PHP Syntax (Toggle Plain Text)
$path = $_SERVER['DOCUMENT_ROOT'] . '/upload/';
Matti Ressler
Suomedia
If you want your dreams to come true, the first thing you must do is to wake up....
Suomedia - Dynamic Content Management
Suomedia - Dynamic Content Management
hope this wil help u .if not reply me
the path should be something like /home/wc.php
mail_attachment.php
where u want to add mail code
the path should be something like /home/wc.php
mail_attachment.php
PHP Syntax (Toggle Plain Text)
<?php function mail_attachment ($from , $to, $subject, $message, $attachment){ $fileatt = $attachment; // Path to the file $fileatt_type = "application/octet-stream"; // File Type $start= strrpos($attachment, '/') == -1 ? strrpos($attachment, '//') : strrpos($attachment, '/')+1; $fileatt_name = substr($attachment, $start, strlen($attachment)); // Filename that will be used for the file as the attachment $email_from = $from; // Who the email is from $email_subject = $subject; // The Subject of the email $email_txt = $message; // Message that the email has in it $email_to = $to; // Who the email is to $headers = "From: ".$email_from; $file = fopen($fileatt,'rb'); $data = fread($file,filesize($fileatt)); fclose($file); $msg_txt="\n\n"; $semi_rand = md5(time()); $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x"; $headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\""; $email_txt .= $msg_txt; $email_message .= "This is a multi-part message in MIME format.\n\n" . "--{$mime_boundary}\n" . "Content-Type:text/html; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $email_txt . "\n\n"; $data = chunk_split(base64_encode($data)); $email_message .= "--{$mime_boundary}\n" . "Content-Type: {$fileatt_type};\n" . " name=\"{$fileatt_name}\"\n" . //"Content-Disposition: attachment;\n" . //" filename=\"{$fileatt_name}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mime_boundary}--\n"; $ok = @mail($email_to, $email_subject, $email_message, $headers); if($ok) { } else { die("Sorry but the email could not be sent. Please go back and try again!"); } } ?>
where u want to add mail code
PHP Syntax (Toggle Plain Text)
<? session_start(); include "mail_attachment.php"; ?> $sent1 = mail_attachment("cgbasket@careerglitters.com",$too, $subject1, $body1, $attachment);
![]() |
Other Threads in the PHP Forum
- Previous Thread: Problem with page navigation
- Next Thread: Form not sending info...
Views: 3760 | Replies: 48
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date datepart directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla jquery limit link list login loop mail menu methods mlm mod_rewrite multiple mysql oop parse password paypal pdf php problem query radio random recursion regex remote script search select seo server sessions sms soap source space speed sql structure syntax system table tutorial update updates upload url validation validator variable video web webdesign xml youtube





