.Net Stats:

How to support the site


Site Wide Message: (current site time 9/6/2010 10:44:20 AM EDT)
  • We want your input! One of our sponsors wants to know your opinion about development related issues. Click here to tell us what you think.
  • Are you an emerging/young developer (aged 18-30)? If so, would you like the chance to affect future developer tools and products?
    If so, then click here to give your feedback.
 
'Ask the .Net Pros Discussion Forum


You are in: Discussion Home | work  | Uploading a file using ASP.NET
 
Uploading a file using ASP.NET 
 
Author:  DTechnology (172.179.213.216) on 1/19/2003 4:59:57 AM
 
Message: 
 
Please help uploading files is driving me crazy. I have tried in c# and now in VB and I just cant seem to get anything other than a null back when looking at the posted file. What am I doing wrong? Please help, I would be most grateful for any help.


Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents FileUp As System.Web.UI.HtmlControls.HtmlInputFile
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Button1 As System.Web.UI.HtmlControls.HtmlInputButton

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub

Private Sub Button1_ServerClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.ServerClick
Label1.Text = FileUp.PostedFile.FileName.ToString



End Sub
End Class  
 
Author:  sachin (68.89.83.90) on 10/15/2003 6:32:39 PM
 
Message: 
 
 
 
Author:  www.e-mandi.com (59.163.27.201) on 12/21/2006 4:37:38 AM
 
Message: 
 
Hi,
You are using wrong control. Please use "<asp:FileUpload>" server side control instead of HTMLFileInput control.

--reference ASP.NET 2.0 
 




To reply, please login using the link on the upper left hand corner of the screen.