...

View Full Version : ASP File upload Deploy help



billboy
03-14-2013, 08:26 PM
So I have my first ASP website project I want to deploy but need some help finishing up

My project will read a txt file database on users computer
using file upload:


If FileUpload1.HasFile Then
Try
FileUpload1.SaveAs("C:\Uploads\" & _
FileUpload1.FileName)
Label1.Text = "File name: " & _
FileUpload1.PostedFile.FileName & "<br>" & _
"File Size: " & _
FileUpload1.PostedFile.ContentLength & " kb<br>" & _
"Content type: " & _
FileUpload1.PostedFile.ContentType
Catch ex As Exception
Label1.Text = "ERROR: " & ex.Message.ToString()
End Try
Else
Label1.Text = "You have not specified a file."
End If

Then I want to pass the file through a TextFieldParser function to create a table


Dim safefilename As String = FileUpload1.FileName

Dim sfilename As String = ("C:\Uploads\emailtest.txt")

ReadTable(sfilename)

The porblem I am having is passing the file

the first line Dim safefilename does not work

if I hard code the file location as in second line Dim sfilename it works

So I obviously need help getting the file properly

Also when I deploy the project on my webhost the file location will obviously be different and I am not sure how that works. Any help would be appreciated I have a little experience with vb.net but I am brand new to this web stuff

Thanks

swamims76
03-17-2013, 10:23 AM
So I have my first ASP website project I want to deploy but need some help finishing up

My project will read a txt file database on users computer
using file upload:


If FileUpload1.HasFile Then
Try
FileUpload1.SaveAs("C:\Uploads\" & _
FileUpload1.FileName)
Label1.Text = "File name: " & _
FileUpload1.PostedFile.FileName & "<br>" & _
"File Size: " & _
FileUpload1.PostedFile.ContentLength & " kb<br>" & _
"Content type: " & _
FileUpload1.PostedFile.ContentType
Catch ex As Exception
Label1.Text = "ERROR: " & ex.Message.ToString()
End Try
Else
Label1.Text = "You have not specified a file."
End If

Then I want to pass the file through a TextFieldParser function to create a table


Dim safefilename As String = FileUpload1.FileName

Dim sfilename As String = ("C:\Uploads\emailtest.txt")

ReadTable(sfilename)

The porblem I am having is passing the file

the first line Dim safefilename does not work

if I hard code the file location as in second line Dim sfilename it works

So I obviously need help getting the file properly

Also when I deploy the project on my webhost the file location will obviously be different and I am not sure how that works. Any help would be appreciated I have a little experience with vb.net but I am brand new to this web stuff

Thanks

--------------



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum