Murugan.com
Murugan Andezuthu Dharmaratnam

  |  HOME   |  BLOG   |  TWITTER   |  ARTICLES   |  8086  |  C++   |  VC++   |  ASP .NET   |  VB .NET   |  JAVA SCRIPT   |  MS SQL   |  MY   |  VIDEOS   |  DOWNLOADS   |  CONTACT ME   |  



ASP.NET How to upload the file and images and view the contents of the uploaded files

Home   ASP.NET   ASP.NET How to upload the file and images and view the contents of the uploaded files         


I have tried the following code but the file is not uploaded.
If Not fileUpload.PostedFile Is Nothing And fileUpload.PostedFile.ContentLength > 0 Then

            Dim fn As String = System.IO.Path.GetFileName(fileUpload.PostedFile.FileName)
            Dim SaveLocation As String = Server.MapPath("~\FILEUPLOADS") & "\" & fn
            Try
                fileUpload.PostedFile.SaveAs(SaveLocation)
                Response.Write("The file has been uploaded.")
            Catch Exc As Exception
                Response.Write("Error: " & Exc.Message)
            End Try
        Else
            Response.Write("Please select a file to upload.")
        End If
Here the file name and the save location string values
are proper,but fileupload.postfile.saveas(savefilelocation)
is not working .Is there any modifications needed ?

I have tried the following code for opening the uploaded files.
System.Diagnostics.Process.Start(Server.MapPath("~\FileUploads\filename.doc"))
It is working well.I it the right way to open the uploaded files.
Is there any problem arises in opening the files after the site is hosted to the web as the System.Diagnostics.Process.Start()
calles the local system processes.





  |  HOME   |  BLOG   |  TWITTER   |  ARTICLES   |  8086  |  C++   |  VC++   |  ASP .NET   |  VB .NET   |  JAVA SCRIPT   |  MS SQL   |  MY   |  VIDEOS   |  DOWNLOADS   |  CONTACT ME   |  

Copyright 2009 @ Murugan Andezuthu Dharmaratnam