Subir Archivos al Servidor
Publicado por Oscar (31 intervenciones) el 30/05/2018 16:21:10
Buenas tengo unos pequeños problemillas a la hora de subir el archivo al servidor este es mi codigo actual , si me funciona en entono local iniciando la aplicacion desde visual studio.
Este codigo viene de un boton :
Primero adjuntaria el archivo por medio del boton de upload y luego lo mandaria llamar desde el boton XmlDetalle
Pero luego me saldria este error:
Alguna sugerencia? gracias por la atencion
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Protected Sub ButtonArchivos_Click_Click(sender As Object, e As EventArgs) Handles ButtonDetalle.Click
Dim filepath As String = Server.MapPath("\Upload")
Dim uploadedFiles As HttpFileCollection = Request.Files
Span1.Text = String.Empty
Referencia = TextReferencia.Text
'Dim dt As New DataTable()
''columnas
'dt.Columns.Add("UUID")
For i As Integer = 0 To uploadedFiles.Count - 1
Dim userPostedFile As HttpPostedFile = uploadedFiles(i)
'Try
If userPostedFile.ContentLength > 0 Then
Span1.Text += "<u>File #" & (i + 1) & "</u><br>"
Span1.Text += "File Content Type: " & userPostedFile.ContentType & "<br>"
Span1.Text += "File Size: " & userPostedFile.ContentLength & "kb<br>"
Span1.Text += "File Name: " & userPostedFile.FileName & "<br>"
userPostedFile.SaveAs(filepath & "\" & Path.GetFileName(userPostedFile.FileName))
Span1.Text += "Location where saved: " & filepath & "\" &
Path.GetFileName(userPostedFile.FileName) & "<p>"
Ruta = filepath & "\" & Path.GetFileName(userPostedFile.FileName)
Dim VarDocumentoXML As XmlDocument = New XmlDocument()
Dim VarManager As XmlNamespaceManager = New XmlNamespaceManager(VarDocumentoXML.NameTable)
VarDocumentoXML.Load(Ruta)
Este codigo viene de un boton :
Primero adjuntaria el archivo por medio del boton de upload y luego lo mandaria llamar desde el boton XmlDetalle
Pero luego me saldria este error:
Alguna sugerencia? gracias por la atencion
Valora esta pregunta
0