Pure PHP Upload 2 Support Product Page

How do I show current file in edit form?

Asked 20 Feb 2010 00:11:57
1
has this question
20 Feb 2010 00:11:57 Steve VanHove posted:
When I have a record to edit that already has a file uploaded for it, how do I make the file name appear in the insert file field?

Here is what I mean - I'd like the current file to appear in the boxes indicated by the red arrows:



Here's my code for those two lines:

<tr valign="baseline">
<td nowrap="nowrap" align="right">PDF (EN):</td>
<td><input type="text" name="pdf_en" value="<?php echo htmlentities($row_rsDocumentationEdit['pdf_en'], ENT_COMPAT, 'UTF-8'); ?>" size="32" /></td>
</tr>

<tr valign="baseline">
<td nowrap="nowrap" align="right">PDF (FR):</td>
<td><input type="text" name="pdf_fr" value="<?php echo htmlentities($row_rsDocumentationEdit['pdf_fr'], ENT_COMPAT, 'UTF-8'); ?>" size="32" /></td>
</tr>

Thank you!

Replies

Replied 22 Feb 2010 10:46:54
22 Feb 2010 10:46:54 Miroslav Zografski replied:
Hello Steve,

Due to security reasons the file input field does not display a preset "value" attribute value. That is an cross browser setting. What I can advise you is to place two more rows in your form and set there a binding to the referring fields in your database to show over each upload field the name of the currently uploaded file.

Regards,
Replied 22 Feb 2010 16:51:55
22 Feb 2010 16:51:55 Steve VanHove replied:
OK I think I understand.

The file input fields show what you want to upload, not what is in the database, like the other fields, right?
Replied 22 Feb 2010 17:45:09
22 Feb 2010 17:45:09 Miroslav Zografski replied:
Hello Steve,

They need to have your value that is set in the database in order to keep it if no changes are made, but they cannot display it. That's why you need to set something else to preview the values(files) that are already set in the database.

Regards,
Replied 22 Feb 2010 19:03:26
22 Feb 2010 19:03:26 Steve VanHove replied:
Quotein order to keep it if no changes are made


Suppose I do as you suggest but they do want to upload a new file? Will that work?
Replied 23 Feb 2010 10:10:14
23 Feb 2010 10:10:14 Miroslav Zografski replied:
Hello Steve,

Yes, it will. When a new file is assigned it will override the value you have appointed as default by binding the database entry to that field.

Regards,

Reply to this topic