客户端文件上传
    HTML: 
 <td>Input Net File: <input id="uploadnet" type="file" runat="server"></td> 
Program Code: 
private bool uploadfile() 
  { 
   try 
   { 
    string uploadFileNet,uploadFileXrf;    
    
    uploadFileNet=uploadnet.Value; 
    int i=uploadFileNet.LastIndexOf("\\"); 
    string NetFileName=uploadFileNet.Substring(i+1);    
    pullpathNET=@"d:\temp\"+NetFileName;    
    
    
    uploadFileXrf=uploadxrf.Value; 
    int j=uploadFileXrf.LastIndexOf("\\"); 
    string XrfFileName=uploadFileXrf.Substring(j+1);    
    pullpathXRF=@"d:\temp\"+XrfFileName; 
    
    int extendNet,extentXrf; 
    extendNet=NetFileName.LastIndexOf("."); 
    extentXrf=XrfFileName.LastIndexOf("."); 
    string strextendNet,strextentXrf; 
    strextendNet=NetFileName.Substring(extendNet+1); 
    strextentXrf=XrfFileName.Substring(extentXrf+1); 
                if ((strextendNet.ToUpper()=="NET")&&(strextentXrf.ToUpper()=="XRF")) 
    { 
     uploadnet.PostedFile.SaveAs(pullpathNET); 
     uploadxrf.PostedFile.SaveAs(pullpathXRF); 
     return true; 
    } 
    else 
    { 
                    Response.Write("<script>Windows.alert('Îļþ¸ñʽ²»¶Ô');</script>"); 
     return false; 
    }     
   } 
            catch (Exception exc) 
   { 
                Response.Write(exc.Message); 
    return false; 
   } 
  } 
在Web.Config 里面加入: 
    <httpRuntime 
    maxRequestLength="1048576" 
    executionTimeout="3600" 
    /> 
 
                    
                 
                
            
         
         浙公网安备 33010602011771号
浙公网安备 33010602011771号