Serious problem with attchments-please help

Reply

Join Date: Mar 2008
Posts: 154
Reputation: Suomedia is an unknown quantity at this point 
Solved Threads: 19
Suomedia Suomedia is offline Offline
Junior Poster

Re: Serious problem with attchments-please help

 
0
  #31
Apr 2nd, 2008
Originally Posted by Vity View Post
The full file system is the way the folders are structured in the site ?
It the directory structure of your webspace on the server. Create a file with this, put it in your main directory and open it:

  1. <?php
  2. echo $_SERVER['DOCUMENT_ROOT'];
  3. ?>

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
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 26
Reputation: Vity is an unknown quantity at this point 
Solved Threads: 0
Vity Vity is offline Offline
Light Poster

Re: Serious problem with attchments-please help

 
0
  #32
Apr 9th, 2008
Could you please give me a detailed explanation and example about what you said the path must be writeable 777. Beatre i'm kind of lost when you mention that ?
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 154
Reputation: Suomedia is an unknown quantity at this point 
Solved Threads: 19
Suomedia Suomedia is offline Offline
Junior Poster

Re: Serious problem with attchments-please help

 
0
  #33
Apr 9th, 2008
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
If you want your dreams to come true, the first thing you must do is to wake up....
Suomedia - Dynamic Content Management
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 26
Reputation: Vity is an unknown quantity at this point 
Solved Threads: 0
Vity Vity is offline Offline
Light Poster

Re: Serious problem with attchments-please help

 
0
  #34
Apr 10th, 2008
Is it possible to change the path of the attachment script to an email address so it is also sent to the same place as the rest of the text ?
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 154
Reputation: Suomedia is an unknown quantity at this point 
Solved Threads: 19
Suomedia Suomedia is offline Offline
Junior Poster

Re: Serious problem with attchments-please help

 
0
  #35
Apr 10th, 2008
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 want your dreams to come true, the first thing you must do is to wake up....
Suomedia - Dynamic Content Management
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 26
Reputation: Vity is an unknown quantity at this point 
Solved Threads: 0
Vity Vity is offline Offline
Light Poster

Re: Serious problem with attchments-please help

 
0
  #36
Apr 10th, 2008
Okay..... So if i create a folder called upload in the server and in the path put uploader will the attached files be sent to this folder ?
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 154
Reputation: Suomedia is an unknown quantity at this point 
Solved Threads: 19
Suomedia Suomedia is offline Offline
Junior Poster

Re: Serious problem with attchments-please help

 
0
  #37
Apr 10th, 2008
Yes. This should work:

  1. $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
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 145
Reputation: queenc is an unknown quantity at this point 
Solved Threads: 4
queenc's Avatar
queenc queenc is offline Offline
Junior Poster

Re: Serious problem with attchments-please help

 
0
  #38
Apr 11th, 2008
hope this wil help u .if not reply me
the path should be something like /home/wc.php

mail_attachment.php

  1. <?php
  2. function mail_attachment ($from , $to, $subject, $message, $attachment){
  3.  
  4.  
  5. $fileatt = $attachment; // Path to the file
  6. $fileatt_type = "application/octet-stream"; // File Type
  7. $start= strrpos($attachment, '/') == -1 ? strrpos($attachment, '//') : strrpos($attachment, '/')+1;
  8. $fileatt_name = substr($attachment, $start, strlen($attachment)); // Filename that will be used for the file as the attachment
  9.  
  10. $email_from = $from; // Who the email is from
  11. $email_subject = $subject; // The Subject of the email
  12. $email_txt = $message; // Message that the email has in it
  13.  
  14. $email_to = $to; // Who the email is to
  15.  
  16. $headers = "From: ".$email_from;
  17.  
  18. $file = fopen($fileatt,'rb');
  19. $data = fread($file,filesize($fileatt));
  20. fclose($file);
  21. $msg_txt="\n\n";
  22.  
  23. $semi_rand = md5(time());
  24. $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
  25.  
  26. $headers .= "\nMIME-Version: 1.0\n" .
  27. "Content-Type: multipart/mixed;\n" .
  28. " boundary=\"{$mime_boundary}\"";
  29.  
  30. $email_txt .= $msg_txt;
  31.  
  32. $email_message .= "This is a multi-part message in MIME format.\n\n" .
  33. "--{$mime_boundary}\n" .
  34. "Content-Type:text/html; charset=\"iso-8859-1\"\n" .
  35. "Content-Transfer-Encoding: 7bit\n\n" .
  36. $email_txt . "\n\n";
  37.  
  38. $data = chunk_split(base64_encode($data));
  39.  
  40. $email_message .= "--{$mime_boundary}\n" .
  41. "Content-Type: {$fileatt_type};\n" .
  42. " name=\"{$fileatt_name}\"\n" .
  43. //"Content-Disposition: attachment;\n" .
  44. //" filename=\"{$fileatt_name}\"\n" .
  45. "Content-Transfer-Encoding: base64\n\n" .
  46. $data . "\n\n" .
  47. "--{$mime_boundary}--\n";
  48.  
  49.  
  50. $ok = @mail($email_to, $email_subject, $email_message, $headers);
  51.  
  52. if($ok) {
  53. } else {
  54. die("Sorry but the email could not be sent. Please go back and try again!");
  55. }
  56. }
  57. ?>


where u want to add mail code

  1. <?
  2. session_start();
  3. include "mail_attachment.php";
  4. ?>
  5. $sent1 = mail_attachment("cgbasket@careerglitters.com",$too, $subject1, $body1, $attachment);
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 26
Reputation: Vity is an unknown quantity at this point 
Solved Threads: 0
Vity Vity is offline Offline
Light Poster

Re: Serious problem with attchments-please help

 
0
  #39
Apr 12th, 2008
i have attached my php script that i need to attach files to. Could you please place that attachment script you gave me queec?
Attached Files
File Type: php datingavenue.php (4.8 KB, 3 views)
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 26
Reputation: Vity is an unknown quantity at this point 
Solved Threads: 0
Vity Vity is offline Offline
Light Poster

Re: Serious problem with attchments-please help

 
0
  #40
Apr 12th, 2008
sorry i mean queenc
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC