Re: [PHP] PHP Email Attachment problem

2003-04-04 Thread Michael Arena
When I put change the line you suggested to "
Line25 $fileatt  =
"/home/sites/webserver.agraservices.net/web/mike/$_POST['fileatt']";
$fileatt_type = $_FILES['fileatt']['type'];// Type of
file being sent
$fileatt_name = $_FILES['fileatt']['name'];// Name of
file
"

I get the following error:
"Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or
`T_NUM_STRING' in /home/sites/home/web/upload.php on line 25"

???


- Original Message -
From: "Burhan Khalid" <[EMAIL PROTECTED]>
Newsgroups: php.general
To: "Michael Arena" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Friday, April 04, 2003 1:21 PM
Subject: Re: [PHP] PHP Email Attachment problem


> Michael Arena wrote:
> > did that...still sends only a file called ".txt" size zero   ?
>
> try replacing $fileatt with $_POST['fileatt']
>
>
>
> --
> Burhan Khalid
> phplist[at]meidomus[dot]com
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Email Attachment problem

2003-04-04 Thread Michael Arena
did that...still sends only a file called ".txt" size zero   ?

thanks for the help,
mike


- Original Message -
From: "Burhan Khalid" <[EMAIL PROTECTED]>
Newsgroups: php.general
To: "Michael Arena" <[EMAIL PROTECTED]>;
<[EMAIL PROTECTED]>
Sent: Friday, April 04, 2003 11:48 AM
Subject: Re: [PHP] PHP Email Attachment problem


> Michael Arena wrote:
> > After reading the file_upload section on PHP.net i got the following
script
> > working on the  server..it sends an attachment from a form now but it's
just
> > of size 0 and always a txt file. I know it must be some little thing
wrong
> > then this will work, maybe you can eye it for me and let me know if you
> > think i should change anything..
> >
> [ snip ]
>
>  if ($fileatt != "")
> >  {
> > $uploaddir = '/home/sites/webserver.agraservices.net/web/mike/';
> > echo "it found the attachment";
> >move_uploaded_file($_FILES['fileatt']['tmp_name'], uploaddir .
> > $_FILES['fileatt']['name']);
> >}
>
> uploaddir needs to be $uploaddir in your move_uploaded_file function
>
> [ snip ]
>
> --
> Burhan Khalid
> phplist[at]meidomus[dot]com
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Email Attachment problem

2003-04-04 Thread Michael Arena
After reading the file_upload section on PHP.net i got the following script
working on the  server..it sends an attachment from a form now but it's just
of size 0 and always a txt file. I know it must be some little thing wrong
then this will work, maybe you can eye it for me and let me know if you
think i should change anything..

thanks,
Mike

-form code---



Form Test





  File to upload:

  
  



end form code--
-begin upload.php code--

   Thank you for taking the time to subscribe for
our free document.
   Please find the document attached to this
email.";

 if ($fileatt != "")
 {
$uploaddir = '/home/sites/webserver.agraservices.net/web/mike/';
echo "it found the attachment";
   move_uploaded_file($_FILES['fileatt']['tmp_name'], uploaddir .
$_FILES['fileatt']['name']);
   }
 // Obtain file upload vars
   $fileatt  = "/home/sites/webserver.agraservices.net/web/mike/";   //
Location of file on server
   $fileatt_type = $_FILES['fileatt']['type'];// Type of file being sent
   $fileatt_name = $_FILES['fileatt']['name'];// Name of file

 $headers = "From: $from";

 if (file_exists($fileatt))
{
   // Read the file to be attached ('rb' = read binary)
   $file = fopen($fileatt,'rb');
   $data = fread($file,filesize($fileatt));
   fclose($file);

  // Generate a boundary string
   $semi_rand = md5(time());
   $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

  // Add the headers for a file attachment
   $headers .= "\nMIME-Version: 1.0\n" .
  "Content-Type: multipart/mixed;\n" .
  " boundary=\"{$mime_boundary}\"";

  // Add a multipart boundary above the plain message
   $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" .
 $message . "\n\n";

   // Base64 encode the file data
   $data = chunk_split(base64_encode($data));

   // Add file attachment to the message
   $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";
 }
 mail($to, $subject, $message, $headers);
echo "Thanks for sending mail";
?>
-end upload.php code

thanks again for your help,
Mike





- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Friday, April 04, 2003 1:36 AM
Subject: Re: [PHP] PHP Email Attachment problem


> On Friday 04 April 2003 06:10, Michael Arena wrote:
> > Made some progress today. Found an attachment  script in the archives. I
> > was able to send an email attachment if it was already on the server.
now i
> > just need the file to come from a form instead of already being on the
> > server but that's not working yet.
>
> It sounds to me you've definitely got an upload problem.
>
> Try the upload example in the manual and let us know if you can get that
> working.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> Rainy days and automatic weapons always get me down.
> */
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Email Attachment problem

2003-04-04 Thread Michael Arena
Just tried  the example and i can upload a file to a directory on my server.
So i can do both uploads and attachments seperately, now it's just a matter
of doing them at the same time.

-Mike


- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Friday, April 04, 2003 1:36 AM
Subject: Re: [PHP] PHP Email Attachment problem


> On Friday 04 April 2003 06:10, Michael Arena wrote:
> > Made some progress today. Found an attachment  script in the archives. I
> > was able to send an email attachment if it was already on the server.
now i
> > just need the file to come from a form instead of already being on the
> > server but that's not working yet.
>
> It sounds to me you've definitely got an upload problem.
>
> Try the upload example in the manual and let us know if you can get that
> working.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> Rainy days and automatic weapons always get me down.
> */
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Email Attachment problem

2003-04-03 Thread Michael Arena
Made some progress today. Found an attachment  script in the archives. I was
able to send an email attachment if it was already on the server. now i just
need the file to come from a form instead of already being on the server but
that's not working yet.

HTML form code to submit file user wants uploaded---



Form Test





  File to upload:
  
  



--end html code--
---upload.php code-

   Thank you for taking the time to subscribe for
our free document.
   Please find the document attached to this
email.";

 // Obtain file upload vars
 $fileatt = $_FILES['fileatt']['tmp_name'];
$fileatt_type = $_FILES['fileatt']['type'];
$fileatt_name = $_FILES['fileatt']['name'];
 $headers = "From: $from";

 // If the file exists...
 if (!file_exists($fileatt))
  {
echo "the file doesn't exist";
  }

 if (file_exists($fileatt))
{
   // Read the file to be attached ('rb' = read binary)
   $file = fopen($fileatt,'rb');
   $data = fread($file,filesize($fileatt));
   fclose($file);

  // Generate a boundary string
   $semi_rand = md5(time());
   $mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";

  // Add the headers for a file attachment
   $headers .= "\nMIME-Version: 1.0\n" .
  "Content-Type: multipart/mixed;\n" .
  " boundary=\"{$mime_boundary}\"";

  // Add a multipart boundary above the plain message
   $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" .
 $message . "\n\n";

   // Base64 encode the file data
   $data = chunk_split(base64_encode($data));

   // Add file attachment to the message
   $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";
 }
 mail($to, $subject, $message, $headers);
echo "Thanks for sending mail";
?>
---end upload.php code-

any suggestions on how to get this form going

thanks a million, you've been a big help,
Mike



- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 03, 2003 11:48 AM
Subject: Re: [PHP] PHP Email Attachment problem


> On Thursday 03 April 2003 22:30, Michael Arena wrote:
>
> > I just checked the directory that I specified for temporary uploads
> > (/tmpuploads) and there is nothing there which leads me to believe the
file
> > isn't getting uploaded.
>
> I'm not sure *how* you're checking that there's nothing there but please
read
> the chapter in the manual about file uploads (yes all of it) and note that
> uploaded files are deleted upon termination of the script.
>
> > Does the PHP code look ok? I suspect there's
> > something in there that's not right.
>
> OK, you said on the RAQ server you don't get an attachment, have you
checked
> that:
>
>  if (is_uploaded_file($fileatt))
>
> is true?
>
> > I could email you a copy of my PHP.ini file
>
> No thank you.
>
> > if you want to check that out
> > as well because I didn't see anything in there called file_upload.
>
> Make sure your php.ini has the following line
>
> file_uploads = On
>
> Also make sure you're not uploading any files that are exceeding the
limits
> set in php.ini (see manual for the relevant config settings which governs
> this).
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> spagmumps, n.:
> Any of the millions of Styrofoam wads that accompany mail-order items.
> -- "Sniglets", Rich Hall & Friends
> */
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Email Attachment problem

2003-04-03 Thread Michael Arena
I just checked the directory that I specified for temporary uploads
(/tmpuploads) and there is nothing there which leads me to believe the file
isn't getting uploaded. Does the PHP code look ok? I suspect there's
something in there that's not right.
I could email you a copy of my PHP.ini file if you want to check that out as
well because I didn't see anything in there called file_upload.

Thanks,
Mike

- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 03, 2003 12:23 AM
Subject: Re: [PHP] PHP Email Attachment problem


> On Wednesday 02 April 2003 04:19, Michael Arena wrote:
> > the only difference in the server setup is on my remote server it's a
RAQ
> > and locally i'm using Xitami with PHP. I don't understand why it won't
> > send. I get the email over the RAQ but no attachment...
>
> Have you checked that the file actually gets uploaded?
>
> > are there any other
> > settings that could differ that I would need to set? Like in the php.ini
> > file?
>
> Have you enabled file_uploads in php.ini?
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> Our ISP is having {switching,routing,SMDS,frame relay} problems
> */
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP Email Attachment problem

2003-04-01 Thread Michael Arena
the only difference in the server setup is on my remote server it's a RAQ
and locally i'm using Xitami with PHP. I don't understand why it won't send.
I get the email over the RAQ but no attachment...are there any other
settings that could differ that I would need to set? Like in the php.ini
file?

Thanks,
Mike


- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
Newsgroups: php.general
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 01, 2003 2:49 PM
Subject: Re: [PHP] PHP Email Attachment problem


> On Wednesday 02 April 2003 03:33, Mike wrote:
>
> > I want to send an email attachment using PHP and the below code works
> > locally but when i upload to my RAQ Cobalt server it doesn't send the
> > attachment and i can't figure out why. If you can offer me any guidance
as
> > to why this is happening it is greatly appreciated.
> > **The sendmail is a custom function listed below also, not the one
inherent
> > to PHP.**
>
> [snip]
>
> 1) How does the server setups differ?
>
> 2) How does your code not work?
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> --
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> --
> /*
> "This isn't brain surgery; it's just television."
> - David Letterman
> */
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php