file upload user control

well...
i created a user control -

<form id="Form1" encType="multipart/form-data" runat="server">
 <table>
  <tr><td><input id="filename" type="file" name="filename" runat="server"></td> 
  </tr>
  <tr><td><input id="uploadBtn" type="button" name="uploadBtn" runat="server"></td>
  </tr>
 </table>
</form>

it has a form tag ...so when im dragging it to my applicaion im getting the error-
System.Web.HttpException: A page can have only one server-side Form tag

so the question is -> is it possible to create a file upload user control if yes, how

thanks



Answer this question

file upload user control

  • Sahil158303

    System.Web.HttpException: A page can have only one server-side Form tag

    That is becouse of u have form tag in ur usercontrol.
    if you drag the userControl to form.. the form doesnt have to have form tag.

    becouse at background they are merging and.. a page can have only one form tag.

    so ur userControl shouldnt have form tag.

    in ur usercontrol u can do everything...  ;)


  • Geeee

    i didnt found any solution to that problem
  • Arilok

    I am having the same error when i am trying to use a File upload User control in ASP.NET code. How did you solve this problem.
    Really in need of this solution.
    Thanks



  • Allways Open Shopper

    but im trying to put a file uploader in the user control,so when im not writing the form tag in the user control and im trying to return the value im getting the error-

    System.NullReferenceException: Object reference not set to an instance of an object

    is there a way to do that
    thanks


  • -me-

    Please post this on the forums.asp.net forums. This forum is for questions regarding C# only.

  • file upload user control