Jump to content
Larry Ullman's Book Forums

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.

 

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...