使用默认文本填充FILE字段 [英] Populate FILE field with default text

查看:122
本文介绍了使用默认文本填充FILE字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图重新使用生成FILE字段的代码,以便在将某些内容添加到数据库时使用,并且在正在编辑或查看有问题的项目时,使用数据库中已存在的数据将其灰显(和禁用)详情。但是,我似乎无法让文字填补这个空白。我使用这个:

I'm trying to reutilize code that generates FILE fields for use when something is to be added to the database, and grayed out (and disabled) with data already in the database when the item in question is being edited or viewed in detail. However, I can't seem to get the text to fill the field. I'm using this:

echo '<input type="file" name="small[]" value="' . $value_from_database . '" DISABLED><br>';

我错过了什么吗?如果没有,是否有任何体面的解决方法?

Am I missing anything? If not, are there any decent workarounds?

推荐答案

由于安全限制, 假设这是可能的,那么可以开发这样一个网页:

This is not possible due to security restrictions. Imagine that this was possible, then one would be able to develop such a webpage:

<!doctype html>
<html lang="en">
    <head><title>Gimme yer passwords.txt!</title></head>
    <body onload="document.upload.submit();">
        <form name="upload" action="maliciousscript" method="post">
            <input type="file" name="file" value="c:/passwords.txt">
            <input type="submit">
        </form>
    </body>
</html>

我只是将它显示在一个简单的< input type =文字禁用> 字段。

I would instead just show it in a simple <input type="text" disabled> field.

这篇关于使用默认文本填充FILE字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆