Hi, I am running PHP 4.10 off my Win2000 box, and I am trying to upload a
file to it (Apache is running off the same box I'm uploading from).

I have the following form:

=============
<FORM method="POST" action="catalog_admin.php?action=additemsave"
enctype="multipart/form-data">
<INPUT type="hidden" name="MAX_FILE_SIZE" value="10000">
<INPUT type="file" name="userfile">
<input type="submit" name="additem_submit" value="Add Product"> <input
type="reset" name="reset" value="Reset Form">
</FORM>
============

and the php script that handles it:

============
<?php
$sql = "INSERT INTO products (category_id, item_name, item_company,
item_price, item_listprice, item_discount, dimensions_height,
dimensions_width, dimensions_length, dimensions_weight_lbs, number_in_stock,
product_description)
values('$category_id','$item_name','$item_company','$item_price','$item_list
price','$item_discount','$dimensions_height',
'$dimensions_width','$dimensions_length','$dimensions_weight_lbs','$number_i
n_stock','$product_description')";
$result = mysql_query($sql, $dbconn) or die(mysql_error());
$item_id = mysql_insert_id();
$array = explode("/", $userfile_type);
if ($array[1] == "pjpeg" || $array[1] == "jpeg") {
$array[1] = "jpg";
}
$ext = $array[1];
$new_file = "$imagedir" . "\\" . "$item_id.$ext";
if (!move_uploaded_file($userfile, $new_file)) {
$sql = "DELETE FROM products WHERE (item_id = '$item_id')";
$result = mysql_query($sql);
metadie("Unable to move the uploaded image file to the new directory
($imagedir) ($new_file) ($userfile). Image type was ".$array[1]);
}
$sql = "UPDATE products SET image_src='$new_file' WHERE (item_id =
'$item_id')";
$result = mysql_query($sql);
?>
==========================
My problem is, whenever I upload an image, $userfile is always "none". I
know I'm uploading it on the form end, but it doesn't seem to register it on
the PHP script's end. Any help here?

Thanks,
David Balatero ([EMAIL PROTECTED])


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to