Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
net/forums/topic/33331-upload-using-http/
Re: Upload using HTTP
Posted 30 August 2010 - 06:53 AM
Hi nomlah25,
in Project:
Add References "Microsoft WinHTTP Services, version 5.1" : winhttp.dll
in Form:
Add Text1.text="", Text2.text="value1=1&value2=2"
Add buttons: Command1.Caption="Upload File", b_leerURL.Caption="LeerURL",
b_downloadurl.Caption="Download File"
in code form :
Private Sub b_downloadurl_Click()
Text1.Text = downloadFile("http://10.6.105.34/upload06/getfile.php", App.Path +
"\bajando_getfile.php")
End Sub
ReDim LIS_AR(3)
LIS_AR(1).ruta_ar = "c:\reporte_getPacienteByFechaModificacion_20100908.pdf"
LIS_AR(1).nombre_ar = "archivo1.pdf"
LIS_AR(2).ruta_ar = "c:\XqueryProperties.xml"
LIS_AR(2).nombre_ar = "archivo1.xml"
LIS_AR(3).ruta_ar = "c:\ReporteAction[1].htm"
LIS_AR(3).nombre_ar = "archivo1.htm"
End Sub
---
incode module:
'/// INI DOWNLOAD FILE
Option Explicit
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA"
(ByVal pCaller As Long, ByVal szURL As String, ByVal szFileName As String, ByVal
dwReserved As Long, ByVal lpfnCB As Long) As Long
Private Declare Function InternetOpen Lib "wininet" Alias "InternetOpenA" (ByVal
sAgent As String, ByVal lAccessType As Long, ByVal sProxyName As String, ByVal
sProxyBypass As String, ByVal lFlags As Long) As Long
Private Declare Function InternetCloseHandle Lib "wininet" (ByVal hInet As Long) As
Integer
'/// FIN DOWNLOAD FILE
For i = 1 To UBound(LIS_AR)
Next i
'----------------------------------------------------------------------------------
------------------
' Because of binary zeros, post body has to convert to byte array
aPostBody = StrConv(strBody, vbFromUnicode)
Exit Function
SaveErrHandler:
uploadFiles = Err.Description
getArchivoComoString = strFile
End Function
LeerURL = sData
End Function
End Function
------
in getfile.php:
<?php
$value1=$_REQUEST['value1'];
$value2=$_REQUEST['value2'];
$slots=$_REQUEST['slots'];
echo "event_final=".$event."\n";
?>
----------
Here is enviaarchi.php (only show manual upload process)
<html>
<head>
<title>Enviar Archivo al Servidor Repositorio de Logs</title>
</head>
<body>
<form enctype="multipart/form-data" action="./getfile.php" method="post">
<p>Variable1: <input type="text" name="value1" /></p>
<p>Variable2: <input type="text" name="value2" /></p>
You should give all permissions in web site to try this code previously (chmod 775)