日期:2014-05-19  浏览次数:20448 次

头痛的问题
现在有主机和本地机.我要实现这样的效果
点击一个button按钮,把本地目录下的某个文件夹的所有txt文件复制到主机去
问题是button下是用cmd命令行下的copy命令来控制该事件,真伤脑筋.
请各位帮帮忙

------解决方案--------------------
没有权限操作客户端的文件
------解决方案--------------------
不可能做到,批量上传还不能满足你的需求的话,那么考虑activex
------解决方案--------------------
为了IE的安全性, <input type= "file "是不允许JS操作的
所以我们一般所看到的,例如邮箱都是一个file或者多个file
但从来没有指定文件夹的
------解决方案--------------------
我也是COPY的:
----------------------------
在以前的Web应用中,上传文件是个很麻烦的事,现在有了.NET,文件上传变得轻而易举。下面的这个例子实现了多文件上传功能。可以动态添加输入表单,上传的文件数量没有限制。代码如下:

MultiUpload.aspx

<%@ Page Language= "vb " AutoEventWireup= "false " Codebehind= "MultiUpload.aspx.vb "
Inherits= "aspxWeb.MultiUpload " %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN " >
<HTML>
<HEAD>
<title> 多文件上传 </title>
<script language= "JavaScript ">
function addFile()
{
var str = ' <INPUT type= "file " size= "50 " NAME= "File "> '
document.getElementById( 'MyFile ').insertAdjacentHTML( "beforeEnd ",str)
}
</script>
</HEAD>
<body>
<form id= "form1 " method= "post " runat= "server " enctype= "multipart/form-data ">
<center>
<asp:Label Runat= "server " ID= "MyTitle "> </asp:Label>
<P id= "MyFile "> <INPUT type= "file " size= "50 " NAME= "File "> </P>
<P>
<input type= "button " value= "增加(Add) " onclick= "addFile() ">
<asp:Button Runat= "server " Text= "上传 " ID= "Upload "> </asp:Button>
<input onclick= "this.form.reset() " type= "button " value= "重置(ReSet) ">
</P>
</center>
<P align= "center ">
<asp:Label id= "strStatus " runat= "server " Font-Names= "宋体 " Font-Bold= "True "
Font-Size= "9pt " Width= "500px " BorderStyle= "None " BorderColor= "White "> </asp:Label>
</P>
</form>
</body>
</HTML>

后代码:MultiUpload.aspx.vb

Public Class MultiUpload
Inherits System.Web.UI.Page
Protected WithEvents Upload As System.Web.UI.WebControls.Button
Protected WithEvents MyTitle As System.Web.UI.WebControls.Label
Protected WithEvents strStatus As System.Web.UI.WebControls.Label

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.