Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2013
    Posts
    44
    Thanks
    2
    Thanked 0 Times in 0 Posts

    ASP File upload Deploy help

    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:

    Code:
    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

    Code:
     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

  • #2
    New to the CF scene
    Join Date
    Mar 2013
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by billboy View Post
    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:

    Code:
    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

    Code:
     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
    --------------


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •