I'm trying to piece together an email order form. This form has a few different aspects to it. I am getting an error on my for proces, conf_order.php.

Here is my form on order.php I dont think there are any issues on this page..

<form method="post" action="conf_order.php">

<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />

Your Name: <br />
<input type="text" name="visitor" size="45" />
<br />
Your Email:<br />
<input type="text" name="visitormail" size="45" />
<br />
Submit a photo:(accepted image types:.jpeg, .png, .gif; 2MB max)<br/>
<input type="file" name="visitorimage" size="45"/>
Additional information:
<br />
<textarea name="notes" rows="4" cols="70"></textarea>
<br />
Include Shirt: <br/>
 No:<input type="radio" name="shirt" onclick="jfunc(this.value)" value="shirt_no"/>
Yes:<input type="radio" name="shirt" onclick="jfunc(this.value)" value="shirt_yes"/>

<div id="jdiv" style="display:none;">
<select name="size" id="size" onChange="MM_jumpMenu('parent',this,0)">
<input type="submit" value="Submit order" />
<br />

Now my conf_order.php is still a work in progress but I am trying to get whats on there now to work, then I will add the rest once that is finished.
My error is with the image type, it is telling me that its an invalid image type


$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['visitor'];
$visitormail = $_POST['visitormail'];
$notes = $_POST['notes'];
$attn = $_POST['attn'];
$visitorimage = $_FILE['visitorimage'];
$shirtYes = $_POST['shirt_yes'];
$shirtNo = $_POST['shirt_no'];
$size = $_POST['size'];

//image checker
if ((($visitorimage["type"] == "image/gif")
|| ($visitorimage["type"] == "image/jpeg")
|| ($visitorimage["type"] == "image/jpg")
|| ($visitorimage["type"] == "image/pjpeg")
|| ($visitorimage["type"] == "image/png"))
&& ($visitorimage["size"] < 2097152))
  if ($visitorimage["error"] > 0)
    echo "Return Code: " . $visitorimage["error"] . "<br />";
    echo "Upload: " . $visitorimage["name"] . "<br />";
    echo "Type: " . $visitorimage["type"] . "<br />";
    echo "Size: " . ($visitorimage["size"] / 1024) . " Kb<br />";
    echo "Temp file: " . $visitorimage["file"]["tmp_name"] . "<br />";

    if (file_exists("upload/" . $visitorimage["name"]))
      echo $visitorimage["name"] . " already exists. ";
      "upload/" . $visitorimage["name"]);
      echo "Stored in: " . "upload/" . $visitorimage["name"];
  echo "Invalid image type. Please Try again";
//check for shirt


//check for valid information
if (eregi('http:', $notes)) {
die ("Do NOT try that! ! ");
if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
echo "<h2>Use Back - Enter valid e-mail</h2>\n";
$badinput = "<h2>Feedback was NOT submitted</h2>\n";
echo $badinput;
die ("Go back! ! ");

//checks for all fields
if(empty($visitor) || empty($visitormail) || empty($notes ) || empty($visitorimage)) {
echo "<h2>Use Back - fill in all fields</h2>\n";
die ("Use back! ! ");

$todayis = date("l, F j, Y, g:i a") ;

$attn = $attn ;
$subject = $attn;

$notes = stripcslashes($notes);

$message = " $todayis [EST] \n
adition information: $notes \n
From: $visitor ($visitormail)\n
image name: $visitorimage \n
shirt: \n
shirt size: $size \n
tech info : IP = $ip \n
Browser Info: $httpagent \n
Referral : $httpref \n

$from = "From: $visitormail\r\n";

mail("", $subject, $message, $from);


<p align="left">
Date: <?php echo $todayis ?>
<br />
Thank You : <?php echo $visitor ?> ( <?php echo $visitormail ?> )
<br />

Addition information:<br />
<?php $notesout = str_replace("\r", "<br/>", $notes);
echo $notesout; ?>
<br />

<br /><br />
<a href="index.php"> Submit Comment and Return Home </a>


Sorry the commenting is not very good on here..

7 Years
Discussion Span
Last Post by bjeffries

Instead of:

  echo "Invalid image type. Please Try again";

Try this for more information on why the image is being rejected:

   echo "Type: " . $visitorimage["type"] . "<br />";
   echo "Size: " . ($visitorimage["size"] / 1024) . " Kb<br />";
   echo "Invalid image type. Please Try again";

This way you can tell what the type and size of the image are and you can tell why it is being rejected.


The output:
Size: 0 Kb
Invalid image type. Please Try again

So it is not reading the image..

So i dont even know where to begin. I have a feeling it could be a number of things. Right off the bat did you notice if I coded something wrong that would cause the file to not post?

[off topic]I have horrible luck with getting my scripts to work..



So I made some changes but my form still will not process, but my images are going through.

The changes were in the HTML, this is kind of weird though.. when I select a shirt size it automatically redirects me to my index page. But if I quickly hit submit order it processes to the conf_order.php page. I have done this 4 times and pretty confident the images are working.

This is what I see:
Upload: JP_watermark.png
Type: image/png
Size: 51.591796875 Kb
Temp file: /var/tmp/phpQzgCaB
Stored in: upload/JP_watermark.png
Use Back - fill in all fields
Use back! !

Here are the changes to the HTML

<form method="POST" action="conf_order.php" enctype="multipart/form-data"/>
<input type="hidden" name="MAX_FILE_SIZE" value="2097152" />
Submit a photo:(accepted image types:.jpeg, .png, .gif; 2MB max)<br/>
<input type="file" name="file" size="45"/>

Edited by bjeffries: n/a


thanks for your help darkagn,I seemed to have gotten everything up and running. My form still needs a few more things..

on my conf_order.php page, how would I write a function to determin what pay now (paypal) button to present. This is what I want it to do I just dont know really how to write this properly.

//if they chose to get a shirt display this paypal button
if ($shirtYes) { 
    echo "paypal button code";
//if they did not chose a shirt
else ($shirtNo) {
    echo "other paypal button";

Is it even possible to incorporate a paypal button code within php?
When I am writing a php statement how do I say if something is true? Like in the case of $shirtYes.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.