file upload

G

Guest

I am trying to upload a file, but I keep getting nothing uploaded

<form enctype="multipart/form-data" runat="server" ID="Form1" method="post"><INPUT type="file"><asp:TextBox id="TextBox1" runat="server"></asp:TextBox><asp:Button id="Button1" runat="server" Text="Button"></asp:Button></form

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Clic
Response.Write(Request.Files.Count
End Su

The button shows a file count of 0

What am I doing wrong

Thanks in advance
Mark Finkel
 
P

Patrice

You need to have a name attribute on your input type=file tag.

Input elements without a name atrtribute are not submitted...

Patrice

Mark Finkel said:
I am trying to upload a file, but I keep getting nothing uploaded:

<form enctype="multipart/form-data" runat="server" ID="Form1"
method="post"><INPUT type="file"><asp:TextBox id="TextBox1"
runat="server"> said:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
 
B

bruce barker

you need a name attribute and the runat=server attritbute on the file input
tag.

-- bruce (sqlwork.com)


Mark Finkel said:
I am trying to upload a file, but I keep getting nothing uploaded:

<form enctype="multipart/form-data" runat="server" ID="Form1"
method="post"><INPUT type="file"><asp:TextBox id="TextBox1"
runat="server"> said:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
 
S

Steven Cheng[MSFT]

Hi Mark,

I think Bruce and Patrice's suggestions are quite reasonable, all the input
fields need to be submited need a name attribute to identify it. In
addition, I recommend the following link which provide a very good guide on
using the inputfile control to implement file uploading in ASP.NET
application:

#Uploading Files Using the File Field Control
http://msdn.microsoft.com/asp.net/default.aspx?pull=/library/en-us/dnaspp/ht
ml/aspnet-fileupload.asp

Hope this helps.


Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top