2014-03-04 32 views
0
<div class="divMainContainer" ng-controller="loginController"> 
      <form name="loginForm" ng-submit="loginChecks($files)"> 
       <table class="imagetable"> 
        <tr>       
        <td>&nbsp;</td> 
        <td style="color:red;"> {{oneMore.firstName}}</td> 
        </tr> 
        <tr> 
         <th colspan="2">Enter login detail</th>        
        </tr> 
        <tr> 
         <td>User name</td> 
         <td><input type="text" id="txtUserName" ng-model="data.txtName" required></td>         
        </tr> 
        <tr> 
         <td>Password</td> 
         <td><input type="password" ng-model="data.txtPassword" required> </td>  
        </tr> 
        <tr> 
         <td>File upload data</td> 
         <td><input type="file"> </td>  
        </tr> 
        <tr>       
         <td>&nbsp;</td> 
         <td><input type="submit" value="Login"></td> 
        </tr>       
       </table> 
      </form>    
     </div> 

在上面的代碼中。如何在用戶按下提交按鈕時上傳文件上傳..當選擇文件時不應該上傳文件。如何使用提交按鈕在angularjs中傳遞文件?

+0

提供語法,你可以在服務器端得到這個 –

+0

這是特定瀏覽器和FileApi,我沒有看到AngularJS的任務,對不起 –

回答

0

你需要使用的指令,如:https://github.com/danialfarid/angular-file-upload,這將提供句柄在客戶端的文件,示例還爲服務器端API調用

+0

是的。我已經使用過它。但當提交按鈕改變時,沒有關於如何上傳文件的文檔。它工作時,我只是選擇文件,當時它調用onFileSelect()函數。 –

相關問題