Android Question I have problem used j.postfile

naifnas

Active Member
Licensed User
Hi All
I try used postfile but have error
I change setting my server for upload file
but still have error
how I can used ??
library okhttp
and okhttpsutils
b4a ver 9
this log error
Code: Copy
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
ResponseError. Reason: Forbidden, Response: <!DOCTYPE html>
<html style="height:100%">
<head><title> 403 Forbidden

</title></head>
<body style="color: #444; margin:0;font: normal 14px/20px Arial, Helvetica, sans-serif; height:100%; background-color: #fff;">
<div style="height:auto; min-height:100%; ">     <div style="text-align: center; width:800px; margin-left: -400px; position:absolute; top: 30%; left:50%;">
        <h1 style="margin:0; font-size:150px; line-height:150px; font-weight:bold;">403</h1>
<h2 style="margin-top:20px;font-size: 30px;">Forbidden

</h2>
<p>Access to this resource on the server is denied!</p>
</div></div><div style="color:#f0f0f0; font-size:12px;margin:auto;padding:0px 30px 0px 30px;position:relative;clear:both;height:100px;margin-top:-101px;background-color:#474747;border-top: 1px solid rgba(0,0,0,0.15);box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset;">
<br>Proudly powered by  <a style="color:#fff;" href="http://www.litespeedtech.com/error-page">LiteSpeed Web Server</a><p>Please be advised that LiteSpeed Technologies Inc. is not a web hosting company and, as such, has no control over content found on this site.</p></div></body></html>

this code

Code: Copy
        FileName="1.jpg"'ListFile.Get(i)
            j.Initialize("UploadWa",Me)

        j.PostFile("http://www.xx.xxx/xxxx/uploadtxt.php"& "?FileName=" & FileName ,dir,FileName)
            j.GetRequest.Timeout=36000
    '        j.timeout=60000
            Wait For (j) JobDone(J As HttpJob)
            If j.Success Then
                If j.JobName="UploadWa" Then
                    res = j.GetString
                    Log(res)
                    Button1.Text=res
                End If
            Else
                Log("error")
            End If
 
Access to this resource on the server is denied!
the problem is on server side. Correct them first.

You can find examples of uploading a file to a php script in my signature.
 
Upvote 0
Back
Top