62,072
社区成员
发帖
与我相关
我的任务
分享
protected void Button3_Click(object sender, EventArgs e)
{
maxno = 0;
UpLoadInfo tmpInfo = (UpLoadInfo)Session["loadInfo"]; //這里面存的文件列表是客戶端的本地文件路徑
//例如c:\\1.txt之類的
string dd = Server.MapPath("~/UploadFile/");
foreach (infoEntry tmpEntry in tmpInfo.theList)
{
File.Copy(tmpEntry.m_fullfileName, dd + tmpEntry.m_fileName, true); //我認為這一步執行會出問題,服務器看到客戶端的文件是c:\\1.txt,但卻不知道他的具體地址。雖然在本機上運行沒錯誤,但我覺得寫錯了,請大家指正
}
tmpInfo.theList.Clear();
Response.Redirect("UpLoad.aspx");
}
i=2;
function addFile()
{
// debugger;
tb = document.getElementById( 'attAchments ');
newRow = tb.insertRow();
newRow.insertCell().innerHTML = ' <input type="file" name="FileUpload1" runat="server" onchange="CheckImgCss(this);" style="width: 260px"/> <input type=button value= "×" style=" height:18px; width:18px" onclick= "delFile(this.parentElement.parentElement.rowIndex) "> ';
i++;
}
function delFile(index)
{
if(tb.rows.length >0 )
{
document.getElementById( 'attAchments ').deleteRow(index);
}
}
HttpFileCollection HFC = HttpContext.Current.Request.Files;