Jump to content


Photo

Upload Image file and form data


  • Please log in to reply
4 replies to this topic

#1 mike-w

mike-w
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 30 June 2006 - 06:45 PM

Hi everybody,

I have a form with a file input and several other standard inputs (Name, email, location, etc) and am trying to create a getfile.php to upload a .jpg file to the server and then send the form data and the name of the image file to me by email.

The file upload is fine but I keep getting this error:

Warning: mail(): SMTP server response: 501 5.5.4 Invalid Address in D:\hshome\miwhel\bits-uk.com\uploads\getfile.php on line 97

Here is what I have so far: link

Here is line 97:  mail($emailTo, $emailSubject, $emailBody, $emailHeader);

I can get it to work either way, upload works, email doesn't or email works, upload doesn't, but not both. any pointers on the code would be welcome.

Cheers. :-\





#2 jvrothjr

jvrothjr
  • Members
  • PipPipPip
  • Advanced Member
  • 300 posts
  • LocationOhio

Posted 30 June 2006 - 07:48 PM

maybe its a function on your alotted time to complete the code.

Both functions work alone but not together. increase your alotted time to complete task....

line 97 really dont help its a call function that call mail and passes variables.


If you understand everything you know nothing!

http://rcchjr.awardspace.com/

#3 gijew

gijew
  • Members
  • PipPipPip
  • Advanced Member
  • 240 posts
  • LocationCalifornia

Posted 30 June 2006 - 07:53 PM

I would check your email address for $emailTo in case there is improper formatting (i.e. not name@domain.com).  If you're using the mail() function inside of another function and your $emailTo variable is stored OUTSIDE of that function - make sure to declare it a global variable INSIDE of the function.

function whatever() {
  global $emailTo, $emailSubject, $emailBody, $emailHeader;
  mail($emailTo, $emailSubject, $emailBody, $emailHeader);
}

Just a suggestion.
I'm considered good looking in some countries

#4 Koobi

Koobi
  • Staff Alumni
  • Advanced Member
  • 419 posts
  • LocationColombo, Sri Lanka | South Asia

Posted 30 June 2006 - 08:00 PM

yeah i think it's to do with the email address itself as well.

have a look at the manual for the allowed formats: http://www.php.net/m...nction.mail.php


so it seems like this:
$emailTo = '"julie" <julie@bits-uk.com>';

should be:
$emailTo = 'julie <julie@bits-uk.com>';


#5 mike-w

mike-w
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 16 July 2006 - 06:14 AM

Thank you for your help Guys!

Everything is great now.

Cheers.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users