简体   繁体   中英

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

I use input file=”type” and I want to priview the image and then to use this image details in server side..

This is priview the image but I can't use it in server side, to put in db:

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

And if I do:

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

So I don't get a preview image.

I try to copy image_file value to new input type=”text” image_file2 like this:

<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;"/>

But it's not working...

What can I do?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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