Search code examples
c#asp.netfirefoxhttpcontext

context.Request.Files[0] is empty in FireFox,


I want to file Upload

The code is like this :

int iTotal = context.Request.Files.Count;   
if(iTotal>0)
  //Upload()....

It works fine when I use IE7,8,9
But when I use it in FireFox 8 , it doesn't work anymore.
iTotal always equal 0.

Are there any ideas/suggestions to me? EDIT:

I have two page. In page A

 $("idBtnupload").onclick = function()
   { 
     ... 
    fu.Form.submit(); 
    } 
<form id="uploadForm" action="File.ashx?type=<% =type %>" method="post" enctype="multipart/form-data"> 
    <input type="button" value="开始上传" id="idBtnupload" /> 
</form>  

Solution

  • You have to include "runat='server'" attribute to your input file

    example:

     <input type="file" id="myfile1" runat="server" >