Pages

Tuesday, September 24, 2013

How to upload a file with vb.net

        Dim file_name, agency_code, job_code As String
        '-------Building File Name and Upload Excel File to writereaddata\ExcelFiles-----------------------
        file_name = "suneel"
        file_name = file_name.Replace("/", "_")
        file_name = file_name & ".xml"
        Dim path As String = Server.MapPath(".")
        path = path.Substring(0, path.LastIndexOf("\")) & "\foldername\"
        Dim fctype As String = FileUpload1.PostedFile.ContentType
        FileUpload1.Enabled = False
        FileUpload1.PostedFile.SaveAs(path & file_name)
        Session("ffname") = file_name
        FileUpload1.Enabled = False
        Response.Write(path)

No comments:

Post a Comment