job2.PostFile("http://ccotesting.site11.com/serTestUpload.php?FileName=file.zip", File.DirInternal, varZipFileUp)
You can add it as a GET parameter:
B4X:job2.PostFile("http://ccotesting.site11.com/serTestUpload.php?FileName=file.zip", File.DirInternal, varZipFileUp)
You will need to use StringUtils.EncodeUrl to encode the file name (if it has spaces or other non-ASCII characters).
There is a tiny difference in my opinion. If one has the link, she can experiment with the GET parameter. But anyway, I am not that concerned with the security problem. I am more concerned with accidental bad inputs with gets when a user uses a link outside of an app. This happened every day in a intranet app of mineThe POST payload is not more secure than the GET parameters. Especially when both are sent from an app and not seen in the browser.
This is only relevant when the link is in the browser. Not inside the app.If one has the link, she can experiment with the GET parameter.
job2.PostFile("http://ccotesting.site11.com/serTestUpload.php?FileName="&varZipFileUp&"Age="&i&"theSize="&varZipFileUpSize, File.DirInternal, varZipFileUp)
$FileName = $_GET['FileName'];
$PostData = file_get_contents("php://input");
$PostData = file_get_contents("php://input");
file_put_contents('/path/to/uploaddir/upload.zip', $PostData);
$file_handle = fopen('./b4a_'.date("Y-W", time()).'.log', 'a+');
fwrite($file_handle, "======== POST-Data (RAW)====================="."\r\n");
fwrite($file_handle, "PostData = ".$PostData."\r\n");
fwrite($file_handle, "======== POST-Data ========================="."\r\n");
foreach($_POST as $name => $value){
fwrite($file_handle, date("d.m.Y H:i:s", time()).": ".$name."=".$value." ".$add."\r\n");
}
fwrite($file_handle, "======== GET-Data ========================="."\r\n");
foreach($_GET as $name => $value){
fwrite($file_handle, date("d.m.Y H:i:s", time()).": ".$name."=".$value." ".$add."\r\n");
}
fwrite($file_handle, "======================================"."\r\n");
fclose($file_handle);
sendImg.Initialize("sendImgJob", Me)
sendImg.PostFile("http://rete.condorinformatique.com/upload.php?fileName=image.jpg",dir, fileName)
' sendImg.PostString("http://rete.condorinformatique.com/upload.php", "&key2=value2&fileName=image.jpg")
' sendImg.Download2("http://rete.condorinformatique.com/upload.php", _
' Array As String("first key", "first value :)", "second key", "value 2"))
Sub JobDone (Job As HttpJob)
ToastMessageShow("Done ", True)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
Job.Release
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim sendimg As HttpJob
sendimg.Initialize("sendImgJob", Me)
sendimg.PostFile("http://rete.condorinformatique.com/upload.php?fileName=image.jpg", File.DirRootExternal, "1.xls")
End Sub
Sub JobDone (Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
Job.Release
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim sendimg As HttpJob
sendimg.Initialize("sendImgJob", Me)
sendimg.PostFile("http://rete.condorinformatique.com/upload.php?fileName=xximage.jpg", File.DirRootExternal, "image.jpg")
sendimg.PostString("http://rete.condorinformatique.com/upload.php", "&key3=value2&fileName=image.jpg")
End Sub
Sub JobDone (Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
Log(Job.GetString)
Job.Release
End Sub
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (httputils2service) Create **
** Service (httputils2service) Start **
** Service (httputils2service) Start **
JobName = sendImgJob, Success = true
2047056561<pre>Array
(
)
Array
(
[key3] => value2
[fileName] => image.jpg
)
JobName = sendImgJob, Success = true
2132198191<pre>Array
(
)
Array
(
[key3] => value2
[fileName] => image.jpg
)
** Activity (main) Pause, UserClosed = false **
<?PHP
echo rand()."<pre>";print_r($_FILES);
print_r($_REQUEST);
if (isset($_FILES['fileUpload']['name'])) {
$flName = $_FILES['fileUpload']['name'];
move_uploaded_file($_FILES['fileUpload']['tmp_name'],$flName );
}
?>
sendimg.PostFile("http://rete.condorinformatique.com/upload.php?fileName=xximage.jpg", File.DirRootExternal, "image.jpg")
sendimg.PostString("http://rete.condorinformatique.com/upload.php", "&key3=value2&fileName=image.jpg")
Do you mean "GET" or "POST"? My server expects POST.Job.PostFile sends a POST request with the file content as the POST payload. Which format is expected by your server?