Hi,
I need your help, I'm 😕 I'm not an expert or a newbie, but I need to get this script to work for me.
basicaly the script should upload all files to a fix path "files/". which doesn't work, also the name of the file should be uploaded in a database which it does, but includes path , date and file name.
http://mysite/image/files/05_12_56_Harmony [Clark].jpg
what mods should be made to work.
thank you JD57
<?php
include("global.inc.php");
$errors=0;
$error="The following errors occured while processing your form input.<ul>";
$Bloomimage=$HTTP_POST_FILES['Bloomimage'];
$Podimage=$HTTP_POST_FILES['Podimage'];
$Pollenimage=$HTTP_POST_FILES['Pollenimage'];
$Leafimage=$HTTP_POST_FILES['Leafimage'];
$Hybridiser=$HTTP_POST_FILES['Hybridiser'];
if($HTTP_POST_FILES['Bloomimage']['tmp_name']==""){ }
else if(!is_uploaded_file($HTTP_POST_FILES['Bloomimage']['tmp_name'])){
$error.="<li>The file, ".$HTTP_POST_FILES['Bloomimage']['name'].", was not uploaded!";
$errors=1;
}
if($HTTP_POST_FILES['Podimage']['tmp_name']==""){ }
else if(!is_uploaded_file($HTTP_POST_FILES['Podimage']['tmp_name'])){
$error.="<li>The file, ".$HTTP_POST_FILES['Podimage']['name'].", was not uploaded!";
$errors=1;
}
if($HTTP_POST_FILES['Pollenimage']['tmp_name']==""){ }
else if(!is_uploaded_file($HTTP_POST_FILES['Pollenimage']['tmp_name'])){
$error.="<li>The file, ".$HTTP_POST_FILES['Pollenimage']['name'].", was not uploaded!";
$errors=1;
}
if($HTTP_POST_FILES['Leafimage']['tmp_name']==""){ }
else if(!is_uploaded_file($HTTP_POST_FILES['Leafimage']['tmp_name'])){
$error.="<li>The file, ".$HTTP_POST_FILES['Leafimage']['name'].", was not uploaded!";
$errors=1;
}
if($HTTP_POST_FILES['Hybridiser']['tmp_name']==""){ }
else if(!is_uploaded_file($HTTP_POST_FILES['Hybridiser']['tmp_name'])){
$error.="<li>The file, ".$HTTP_POST_FILES['Hybridiser']['name'].", was not uploaded!";
$errors=1;
}
if($errors==1) echo $error;
else{
$image_part = date("h_i_s")."_".$HTTP_POST_FILES['Bloomimage']['name'];
$image_list[0] = $image_part;
copy($HTTP_POST_FILES['Bloomimage']['tmp_name'], "files/".$image_part);
$image_part = date("h_i_s")."_".$HTTP_POST_FILES['Podimage']['name'];
$image_list[1] = $image_part;
copy($HTTP_POST_FILES['Podimage']['tmp_name'], "files/".$image_part);
$image_part = date("h_i_s")."_".$HTTP_POST_FILES['Pollenimage']['name'];
$image_list[2] = $image_part;
copy($HTTP_POST_FILES['Pollenimage']['tmp_name'], "files/".$image_part);
$image_part = date("h_i_s")."_".$HTTP_POST_FILES['Leafimage']['name'];
$image_list[3] = $image_part;
copy($HTTP_POST_FILES['Leafimage']['tmp_name'], "files/".$image_part);
$image_part = date("h_i_s")."_".$HTTP_POST_FILES['Hybridiser']['name'];
$image_list[4] = $image_part;
copy($HTTP_POST_FILES['Hybridiser']['tmp_name'], "files/".$image_part);
$where_form_is="http".($HTTP_SERVER_VARS["HTTPS"]=="on"?"s":"")."://".$SERVER_NAME.strrev(strstr(strrev($PHP_SELF),"/"));
$message="Bloom image: ".$where_form_is."files/".$image_list[0]."
Pod image: ".$where_form_is."files/".$image_list[1]."
Pollen image: ".$where_form_is."files/".$image_list[2]."
Leaf image: ".$where_form_is."files/".$image_list[3]."
Hybridiser: ".$where_form_is."files/".$image_list[4]."
";
$message = stripslashes($message);
mail("snowballjd@virgilio.it","Form Submitted at your website",$message,"From: phpFormGenerator");
$link = mysql_connect("localhost","xxxx_xx","xxxx");
mysql_select_db("xxx_xxx",$link);
$query="insert into upload_image (Bloom_image,Pod_image,Pollen_image,Leaf_image,Hybridiser) values ('".$where_form_is."files/".$image_list[0]."','".$where_form_is."files/".$image_list[1]."','".$where_form_is."files/".$image_list[2]."','".$where_form_is."files/".$image_list[3]."','".$where_form_is."files/".$image_list[4]."')";
mysql_query($query);
?>
<!-- This is the content of the Thank you page, be careful while changing it -->
<h2>Thank you!</h2>
<table width=50%>
<tr><td>Bloom image: </td><td> <?php echo $Bloomimage; ?> </td></tr>
<tr><td>Pod image: </td><td> <?php echo $Podimage; ?> </td></tr>
<tr><td>Pollen image: </td><td> <?php echo $Pollenimage; ?> </td></tr>
<tr><td>Leaf image: </td><td> <?php echo $Leafimage; ?> </td></tr>
<tr><td>Hybridiser: </td><td> <?php echo $Hybridiser; ?> </td></tr>
</table>
<!-- Do not change anything below this line -->
<?php
}
?>