Android Question postfile doc

msarinen

New Member
Licensed User
Longtime User
Can someone show me a clear and simple example of the use of POSTFILE of HTTPTILS?
I an looking fot it at the forum, but I dont find it.
Thanks in agance

Excuse my bad english.
 

DonManfred

Expert
Licensed User
Longtime User
no you dont have searched the forum... There are hundrets of example. Search again

BTW: You have written in the wrong forum... This forum is not for questions.
 
Upvote 0

cooperlegend

Active Member
Licensed User
Longtime User
That's wasn't helpful

If there are so many simple examples in these forums, then WHY have I been search all morning and have yet to find one SIMPLE example of how to use http2 postfile function....

Can someone post one or link to one maybe, that would be a great help...
 
Upvote 0

cooperlegend

Active Member
Licensed User
Longtime User
That is NOT related to postfile....


postfile is a file sending function of httputils.

We just want a SIMPLE example

i.e.

like

Dim jobUpdate As HttpJob
Common.bComms = True
jobUpdate.Initialize("JobSendSignature", Me)
jobUpdate.PostFile(Common.sURL & "updatesignature.php?file=" & Common.JobID & ".png", File.DirDefaultExternal & "/CG", Common.JobID & ".png")

And a simple php web service to capture the file.

PLEASE
 
Upvote 0

cooperlegend

Active Member
Licensed User
Longtime User
Thanks, but I had already found that information and it wasn't what I was after.

I was after a simple solution, and after much searching and trial and error I sussed out the simple solution myself.

As a seasoned Basic4Android user (and multiple licence holder) I was disappointed this time by the lack of help on here.

So for others that may wish to do the same here is the simple solution.

B4X:
    Dim jobUpdate As HttpJob
    jobUpdate.Initialize("JobSendSignature", Me)
    jobUpdate.PostFile("http://example.com/updatesignature.php?file=signature.png", File.DirDefaultExternal, "signature.png")

In your php you can use this simple code ...


B4X:
<?php
   $FileName = $_GET['file'];

   if (!strstr($FileName,"png"))
      return;

   $PostData = file_get_contents("php://input");

   $File = fopen("signatures/" . $FileName,"wb");

   fwrite($File, $PostData);
   fclose($File);
?>


That's it!
 
Upvote 0

cooperlegend

Active Member
Licensed User
Longtime User
I already have 35 years programming experience, I just want to life to be easy now and make some money.

Hence why I use B4A....
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
I was disappointed this time by the lack of help on here.

Keep in mind that we try to help out people for free here and that the majority just grabs code but doesn't give stuff back to the community.

We also have a life (and work) besides this forum so we can only do our best while not everything can be solved in minutes.

As you noticed trial and error is still the best way to go as it might lead to a faster solution than trying to decrypt some of people's sentences :)
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

cooperlegend

Active Member
Licensed User
Longtime User
Obviously you didn't read the first post...

Can someone show me a clear and simple example of the use of POSTFILE of HTTPTILS?

Well, I have done this....
 
Upvote 0
Top