Hi
I use PostString to upload file example below code
How can i show progressing of send file
And i php i get file with below code
I use PostString to upload file example below code
How can i show progressing of send file
B4X:
ht.Initialize("upload",Module)
ht.PostString(Library.WebService & "/upload_file",su.EncodeBase64(ou.ToBytesArray))
ext = getFileExtension(sFile)
stype = getFileType(ext)
ht.GetRequest.SetContentType(stype)
ht.GetRequest.SetHeader("key1",Library.LoginSession.Username)
ht.GetRequest.SetHeader("key2",Library.LoginSession.Password)
ht.GetRequest.SetHeader("key3",Library.phone1.GetDeviceId)
ht.GetRequest.SetHeader("key4",Library.LoginSession.Token)
ht.GetRequest.SetHeader("path",sParentPath)
ht.GetRequest.SetHeader("name",Library.GetFilename(sFile))
ht.GetRequest.SetHeader("extension",ext)
And i php i get file with below code
PHP:
$content = base64_decode(file_get_contents("php://input"));
$len = strlen($content);
$headers = apache_request_headers();
foreach ($headers as $header => $value) {
if ($header == "key1")
$username = $value;
if ($header == "key2")
$password = $value;
if ($header == "key3")
$dev_id = $value;
if ($header == "key4")
$token = $value;
if ($header == "extension")
$ext = $value;
if ($header == "name")
$name = $value;
if ($header == "path")
$path = $value;
}