繁体   English   中英

如何在JavaScript客户端和服务器端使用输入文件类型

[英]How to use input file type in javascript client side and server side

我使用输入文件=“类型”,我想先预览图像,然后在服务器端使用此图像详细信息。

这是priview图片,但我不能在服务器端使用它来放入db:

<input type="file" name="image_file" id="image_file" onchange="fileSelected();"/>

如果我这样做:

<input type="file" name="image_file" id="image_file" onchange="fileSelected();" runat="server"/>

所以我没有预览图像。

我尝试将image_file值复制到新的输入类型=“ text” image_file2,如下所示:

<input type="file" name="image_file" id="image_file" onchange="fileSelected();"/>
<input type="file" name="image_file2" id="image_file2" runat="server" onchange="document.getElementById('image_file') = this;"/>

但这不起作用...

我能做什么?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM