March 23rd, 2012, 10:31 AM
Input name ="File" , set the initial value
I'm really not sure if this a PHP or HTML question.?.
I'm building an edit photo page for my website and would like to change the photo with the browse for file button. When I echo the photo file name with a text field, i get a initial value of the current photo. When I change input name from "text" to "file" I get the "no file selected". If the user doesn't select a photo or the same photo it deletes the database photo file name. I am currently echo-ing out the original name in a row above the browse for file row. Here is what I have tried so far:
echo out old photo name:
Browse for file:
<td nowrap="nowrap" align="right">Org. Image File Name:</td>
<td><?php echo $row_rsPhotos['fullSize']; ?></td>
Is there a way to add a default value of the original photo name ("fullSize") to the browse for file button?
<td nowrap="nowrap" align="right">New Image File Name:</td>
<td><input type="file" name="fullSize" value="<?php echo htmlentities($row_rsPhotos['fullSize'], ENT_COMPAT, 'UTF-8'); ?>" size="32" /></td>
March 23rd, 2012, 11:32 AM
You cannot set the value of a input=file.
In the PHP, don't delete the photo if one was not uploaded. If you want to allow deleting then give a separate "[o] Delete this photo" option (eg, radio or button) and check for that separately.
March 23rd, 2012, 08:04 PM
March 23rd, 2012, 08:57 PM
April 20th, 2012, 11:17 PM
Initial value could be given by the item properties. In dreamweaver you can give it easily.
April 21st, 2012, 12:45 AM
No, that is not correct. You cannot set an initial value for an input=file field.
April 21st, 2012, 02:04 PM
Thanks E-Oreo, I'm still working on the details of my photo management. I'm going to post over in the mySql section about my new problem.