Hi, I have a small problem with my script. I want to be able to add items with or without an image, and so I have part of my script that runs under this clause:
if (isset ($_FILES['new_image']))
But it doesn't seem to be working as if I try to add an item without an image it is still being run and I am therefore deluged with loads of error code. Is this the right piece of code to use for this. The part of the page that this relates to is:
<form action="<?php echo $_server['php-self']; ?>" method="post" enctype="multipart/form-data" id="something" class="uniForm">
<input name="new_image" id="new_image" size="30" type="file" class="fileUpload" />
Best bet judging by the docs would be...
if (isset ($_FILES['new_image']['name']))
Ah, that doesn't seem to work either. I still get the error messages. Any other ideas?
Check $FILES['newimage']['error'] for an no file uploaded error:
From The PHP Manual
UPLOAD_ERR_NO_FILE Value: 4; No file was uploaded.
if($_FILES['new_image']['error'] == 0)
Try this and see what information is being returnedresults:
echo '<pre>'; // cosmetic for readability