Warning: copy() [function.copy]: Filename cannot be empty in /homepages/31/d250709875/htdocs/portal/productFunctions.php on line 173
Warning: copy() [function.copy]: Filename cannot be empty in /homepages/31/d250709875/htdocs/portal/productFunctions.php on line 174
Any help would be greatly appreciated!
Below is my code
form:
Code: Select all
<table width="500" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form action="multiUpload.php" method="post" name="form1" id="form1">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td><strong>multiple Files Upload </strong></td>
</tr>
<tr>
<td>Select file
<input name="ufile[]" type="file" id="ufile[]" size="50" /></td>
</tr>
<tr>
<td>Select file
<input name="ufile[]" type="file" id="ufile[]" size="50" /></td>
</tr>
<tr>
<td align="center"><input type="submit" name="Submit" value="Upload" /></td>
</tr>
</table>
</td>
</form>
</tr>
</table>
Code: Select all
//set where you want to store files
//in this example we keep file in folder upload
//$HTTP_POST_FILES['ufile']['name']; = upload file name
//for example upload file name cartoon.gif . $path will be upload/cartoon.gif
$path1= "images/customHitches".$HTTP_POST_FILES['ufile']['name'][0];
$path2= "images/customHitches".$HTTP_POST_FILES['ufile']['name'][1];
//copy file to where you want to store file
copy($HTTP_POST_FILES['ufile']['tmp_name'][0], $path1);
copy($HTTP_POST_FILES['ufile']['tmp_name'][1], $path2);
///////////////////////////////////////////////////////
// Use this code to display the error or success.
$filesize1=$HTTP_POST_FILES['ufile']['size'][0];
$filesize2=$HTTP_POST_FILES['ufile']['size'][1];
if($filesize1 && $filesize2 != 0)
{
mysql_query("INSERT INTO customOrders (Cust_Name, Email, Phone, Base, Description, Logo_Image, FacePlate_Image)
VALUES('$name', '$email', $phone'', '$base', '$description', '$path1', '$path2')")
or die("Error Encountered while attempting to add custom order");
$result=mysql_query($sql);
// if successfully insert data into database, displays message "Successful".
if($result){
$to = "jose.martinez.it@gmail.com";
$headers = "From:".$email;
$subject = "Custom Hitch Order";
$Message = "You have a Custom Hitch order from \n
Name: '$name' \n
Phone: '$phone' \n
";
mail($to,$subject, $message, $headers);
echo "<a href='insert.php'>Back to main page</a>";
}
else {
echo "ERROR";
}
// close connection
mysql_close();