2 Replies Latest reply on Dec 17, 2007 5:27 AM by FlexPrashant

    file upload with .net

    FlexPrashant Level 1
      I want to upload a file in flex with the help of .Net , please help me
      I have php script but i want to do this with the help of .net .is anybody has the solution
        • 1. Re: file upload with .net
          Alberto_Mz Level 1
          Hi,

          I have used this code in VB.NET:

          Imports System.IO
          Imports System.Web
          Imports System.Web.SessionState

          Partial Class SubirArchivos
          Inherits System.Web.UI.Page

          Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
          Dim strRuta As String = "\\Servidor\Directorio"
          Dim strResultado As String = ""

          Try
          Dim archivos As HttpFileCollection = HttpContext.Current.Request.Files

          If archivos.Count > 0 Then
          Dim archivo As HttpPostedFile = archivos(0)

          If archivo.ContentLength > 0 Then

          Dim strNombreArchivo As String = Path.GetFileName(archivo.FileName)
          Dim strGuardarEn As String = strRuta + "\" + strNombreArchivo

          archivo.SaveAs(strGuardarEn)

          End If

          End If

          Catch ex As Exception
          strResultado = ex.Message
          End Try

          End Sub

          End Class


          the names are in spanish but i think that is not a problem, instead using a hard-coded path to save the file you can use this:

          strRuta = Server.MapPath(archivo.FileName)

          Regards,
          Alberto
          • 2. Re: file upload with .net
            FlexPrashant Level 1
            i am new for .net so can u plz explain more