开发者

Populate form with file name from mysql database

开发者 https://www.devze.com 2023-04-08 10:42 出处:网络
I\'ve created a series of forms for users to add and edit records in a database.The database includes audio and image file names (the actual files are moved to folders on submit).

I've created a series of forms for users to add and edit records in a database. The database includes audio and image file names (the actual files are moved to folders on submit).

My problem is that I can't get the file names to display on the edit forms. Which means that unless the user uploads the files again, those fields are blanked in the database! I understand the "type='file'" does not take a "value" attribute. I was able to get around that in my textareas by simply displaying the php variable in the textarea. I tried that with file names, and they do display, but outside of the input box, which means... see above, blanked fields within the database.

Here's the code I'm using:

<li>
    <label for=se_ogg">Sound excerpt (upload .ogg file)</label>
    <input id="se_ogg" type = "file"
    name =开发者_StackOverflow中文版 "se_ogg">' . $row['se_ogg'] . '</input> 
</li>

Any ideas? Can this be done?


The file input field doesn't allow you to define a value for security reasons otherwise you could hide a file field and use it to grab files from unsuspecting peoples computers. If you just want to display the filename of the file just uploaded just display it as formatted text.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号