Problem with input type="file" in PHP form

Hi, I have a PHP form which displays a set of images (1 to 50) for an item, within an admin area. I’m trying to set it up with a Browse facility for each image so that the admin can browse and pick a new image for upload, for any of the 50 images (or however many there are for that item).

Ideally I want the input to also display the name of the current image, but because I need to use type=“file” it doesn’t seem to be pulling in the value of the existing image to the form.

Also I can successfully browse for and upload a single photo, and it then displays fine within the form. However if I then try and upload another one for one of the other images, the previous image disappears- it seems that the value of the variable gets overwritten, again I’m wondering if this is because of type=“file” being null unless I browse for the value?

In the form I have this in a table for each image:


<input name=\\"_Pic1\\" type=\\"file\\" value='$image1' /><img src=\\"../images/carpictures/$image1\\">

So as you can see the input browses for a new image to upload, whilst the image code next to it displays the current one (if it exists).

But if I upload Pic2, then try to upload Pic1 (for example), Pic2 disappears (not physically of course, but in the mySQL db)

What I need is for existing image values to be preserved when I upload new images for other variables- any idea if/how this can be done?

hmmm i don’t think it has something to do with type=“file”… please show your mysql statement and/or php code. maybe you are updating. Where do you want to display the name of the current image? The values of $image1 on input and on the image are the same? I think it should not.