Files
SIG/Planeacion/CargarArchivo.aspx.vb
JORGE LUIS CAUDILLO ESPARZA c35cf91883 Commit inicial Ventas Productivo
2019-08-14 16:40:54 -07:00

35 lines
1.6 KiB
VB.net

Imports System.IO
Partial Class CargarArchivo
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
Session("FileUpload") = ""
CType(Me.Master, BaseMasterPage).EsPopup = True
CType(Me.Master, BaseMasterPage).PopupWidth = 350
If Request("Tipo") IsNot Nothing AndAlso Request("Tipo").Length > 0 Then
HdnTipo.Value = Request("Tipo")
End If
End If
End Sub
Protected Sub AFU_UploadedComplete(ByVal sender As Object, ByVal e As AjaxControlToolkit.AsyncFileUploadEventArgs) Handles AFU.UploadedComplete
If AFU.HasFile Then
If Not Directory.Exists(Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp") Then
Directory.CreateDirectory(Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp")
End If
Dim UploadFolder As String = Request.PhysicalApplicationPath + "Empresas\" & UsuarioActual.CveEmpresa & "\Temp\"
Dim Extension As String = System.IO.Path.GetExtension(AFU.PostedFile.FileName)
If System.IO.File.Exists(UploadFolder & UsuarioActual.CveUsuario.ToString & Extension) Then
System.IO.File.Delete(UploadFolder & UsuarioActual.CveUsuario.ToString & Extension)
End If
AFU.SaveAs(UploadFolder & UsuarioActual.CveUsuario.ToString & Extension)
Session("FileUpload") = UsuarioActual.CveUsuario.ToString & Extension
End If
End Sub
End Class