0

i have one page which display data beside every data there is one edit link, when i click on that edit link. it display another page which shows the the form filled with data which is fetch from database. now in that form there are two input type="file".

1)for photo

2) resume

<?php
$a =$data['photo'];
?>
<tr>
<td>Photo:</td>
<td><input type="file" onchange="file_selected=true;" name="pic"  ></td>
<td id="f_pic"></td>
</tr>
<tr>
<td colspan=2><img src="Image/<?php echo "$a"; ?>" alt="Photo" width="400" height="200"> </td>
</tr>
<?php
$r =$data['resume'];
?>

<tr>
<td>Resume:</td>
<td><input type="file" onchange="file_selected1=true;" name="doc" id="<?php $data['resume']?>"></td>
<td id="f_doc"></td>
</tr>

now when edit button press all other detail filled bt i cant get value for photo and resume. what should i do?? i don't know.

EDIT

if there is question but i am not satisfied with it. it's all wrong answer. and i have one answer which i am going to post but for that i guess u need to remove duplicate mark i guess.

MageDev
  • 239
  • 2
  • 14
  • All uploaded files are accessible in PHP with $_FILES.. +You must set to your form enctype="multipart/form-data" and attribute name to the input field. – Svetoslav Mar 26 '13 at 10:39
  • @Svetlio: ya its accessible by php i used it bt i dont know when i press edit button it should take by default old file and if i edit then new file. – MageDev Mar 26 '13 at 10:59

2 Answers2

2

1.File field can not be auto filled, check below for alternate solution
2.Show the corresponding image near the file text box, or file name near the resume(view link - to view the current file)
3.User can see the current Image and resume.
4.If user wants to edit them, upload the new files and replace it with old one.
5.If user don't want to edit them, don't update these fields in DB, let it be what it was before.

Prasanth Bendra
  • 31,145
  • 9
  • 53
  • 73
0

For security reasons, browser wont allow you to set values to file. For example, if some page populate these fields with some file containing sensitive information like password and submit the form automatically.

As your intention is to edit the form, it is not a good idea to pre-fill already stored information as if user is not updating photo/resume and just click on Submit, you will be uploading these files again (though browsers wont allow it)

Best idea is, show photo thumbnails/download resume linked if they are already uploaded. If user choose another photo/resume, just update existing one on your backend.

Amit
  • 1,365
  • 8
  • 15