在不使用文本框和浏览按钮的情况下上传文件 [英] To upload Files without using textbox and browse button

查看:105
本文介绍了在不使用文本框和浏览按钮的情况下上传文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我需要不使用文本框上传文件.当我单击上传"按钮时,用户可以从桌面或任何驱动器中选择任何文件.

Hi

i need To upload Files without using textbox . When i click the upload button the the users can select any files from desktop or any drives .

推荐答案



是的,我们可以做到.如果我们使用javascript的话.

只需将这段代码放在您的页面中...

Hi,

Yeah we can do that.If we use javascript that is possible.

just place this code in your page...

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="../Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
    <script src="../Scripts/jquery-1.4.1.js" type="text/javascript"></script>
    <script language ="javascript" >
        function f1() {


(" #fileup1").click(); } < / 脚本 > < /head > < 正文 > < 表单 =" form1" runat >服务器" > < asp: 脚本 经理 id =" runat =" xmlns:asp =" > < /asp: 脚本 经理 > < 输入 =" =" =" f1()" / < 输入 =" id fileup1" 样式 =" / > < /form > < /body > < /html >
("#fileup1").click(); } </script> </head> <body> <form id="form1" runat="server"> <asp:scriptmanager id="ScriptManager1" runat="server" xmlns:asp="#unknown"> </asp:scriptmanager> <input type ="button" value ="put" onclick="f1()" /> <input type="file" id="fileup1" style =" visibility :hidden ;"/> </form> </body> </html>




我希望它也能为您服务

最好的




I hope it can works for you also

All the Best


这篇关于在不使用文本框和浏览按钮的情况下上传文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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