无法获得输入类型=“文件"的值? [英] Can't get value of input type="file"?

查看:18
本文介绍了无法获得输入类型=“文件"的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个

当我使用时:alert($("#uploadPicture").val());

它会提醒一个空对话框.

It alerts an empty dialog.

推荐答案

你可以阅读它,但你不能设置它.value="123" 将被忽略,因此在您单击它并选择一个文件之前它不会有值.

You can read it, but you can't set it. value="123" will be ignored, so it won't have a value until you click on it and pick a file.

即便如此,该值也可能会被c:fakepath 之类的东西弄乱,以保持用户文件系统的详细信息不公开.

Even then, the value will likely be mangled with something like c:fakepath to keep the details of the user's filesystem private.

这篇关于无法获得输入类型=“文件"的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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