Jump to content
Larry Ullman's Book Forums

Add_Other_Products Script


Recommended Posts

Trying to test the upload script ("add_other_products.php") and, after submitting, get blank screen other than header.  When I "refresh" page and resend data, I see a reference to "undefined index: image" which refers to these two lines:

 

// check for image

if (is_uploaded_file($_FILES['image']['tmp_name']) && .... this is line 49 in sample download script

 

switch ($_FILES['image']['error']) {   this is line 104 in sample download script

 

While trying to figure this out, I deleted all references in the file to the image and I successfully added the test record to the database.  But when I added back the references for the image, the same problem came back.

 

I'm probably an intermediate user of php/MySQL and can often figure these things out. This one doesn't make sense.

 

Any suggestions would be appreciate.

 

Link to comment
Share on other sites

First, I'd make sure that display_errors is on so you always see the errors. Then, upon submission, I'd do 

print_r($_FILES);

to see what the script received. The problem may be in your form. So I'd check the names used there and the MAX_FILE_SIZE value.

Link to comment
Share on other sites

 Share

×
×
  • Create New...