Where do I add my email address??? Please help!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jjfletcher90
Forum Newbie
Posts: 18
Joined: Sat Jul 09, 2011 12:38 pm

Where do I add my email address??? Please help!

Post by jjfletcher90 »

Code: Select all

 <?php
    header("Location:http://www.website.com/uploaded.html");
?>
 <?php
 $target = "upload/";
 $target = $target . basename( $_FILES['uploaded']['name']) ;
 $ok=1;

 //This is our size condition
 if ($uploaded_size > 350000)
 {
 echo "Your file is too large.<br>";
 $ok=0;
 }

 //This is our limit file type condition
 if ($uploaded_type =="text/php")
 {
 echo "No PHP files<br>";
 $ok=0;
 }

 //Here we check that $ok was not set to 0 by an error
 if ($ok==0)
 {
 Echo "Sorry your file was not uploaded";
 }

 //If everything is ok we try to upload it
 else
 {
 if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
   {
   echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been
  uploaded";
   @mail($to, $subject, $msg, $headers);
  }
 else
 {
 echo "Sorry, there was a problem uploading your file.";
 }
 }

 ?>
Last edited by jjfletcher90 on Sat Jul 09, 2011 2:07 pm, edited 1 time in total.
jjfletcher90
Forum Newbie
Posts: 18
Joined: Sat Jul 09, 2011 12:38 pm

Re: Where do I add my email address??? Please help!

Post by jjfletcher90 »

By the way.... This is the upload form!

Code: Select all


<form enctype="multipart/form-data" action="upload.php" method="POST">
 Please Upload the Desired Signature file<p>Please choose a file: <input name="uploaded" type="file" /><br />
 <input type="submit" value="Upload" />
 </p>
 </form>

oscardog
Forum Contributor
Posts: 245
Joined: Thu Oct 23, 2008 4:43 pm

Re: Where do I add my email address??? Please help!

Post by oscardog »

And this is why you shouldn't just copy code straight from a tutorial. At least, it looks like it's from a tutorial and you've changed it. For a start, setting that header() at the top will mean nothing is ever done with the form, it will just send the user straight to uploaded.html.

Move the header() line to the line below @mail($to, $subject, $msg, $headers); and change the '$to' in that line (the mail line) to where you want the email to go. However, it hasn't set any other parameters such as subject / msg etc.
jjfletcher90
Forum Newbie
Posts: 18
Joined: Sat Jul 09, 2011 12:38 pm

Re: Where do I add my email address??? Please help!

Post by jjfletcher90 »

Correct as you pointed out... I am new to this and cut and pasted what i could find to try and produce the results needed... tough to say the least if one does not know what they are doing... "Like Me"... Anyway ... I appreciate your feedback and will try to manipulate the code as suggested... Hope I have success... again thanks for the response! John
jjfletcher90
Forum Newbie
Posts: 18
Joined: Sat Jul 09, 2011 12:38 pm

Re: Is this accurate??? Please help!

Post by jjfletcher90 »

Code: Select all


echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been
   uploaded";
    @mail($name@myemailaddress.com, $subject, $msg, $headers);
   header("Location:http://www.exactusign.com/members/Members_Area/uploaded.html");
   }
  else
  {
  echo "Sorry, there was a problem uploading your file.";
  }
  }

 ?>
When I made this manipulation to the code I received the following error!

Code: Select all

Parse error: syntax error, unexpected '@' in D:\Hosting\3945010\html\ExactUSign\members\Members_Area\upload.php on line 34
Post Reply