jpvniekerk Active Member Licensed User Longtime User Oct 7, 2012 #1 When I try to upload a file with HttpUtils2, I get "Error: forbidden" I've changed the permissions for the folder to 777, but no luck. I can download a file from the same URL without any problems. (replaced the actual urls details with ____) B4X: Dim job1,job2 As HttpJob Dim myurl,dlfilename,ulfiledir,lufilename As String job1.Initialize("Job1", Me) job2.Initialize("Job2", Me) myurl = "http://www.__________.com/_________/" dlfilename = "testdlfile.txt" ulfiledir = File.DirRootExternal ulfilename = "testulfile.txt" job1.Download(myurl&dlfilename) job2.PostFile(myurl,ulfiledir,ulfilename) What am I doing wrong (or omitting)?
When I try to upload a file with HttpUtils2, I get "Error: forbidden" I've changed the permissions for the folder to 777, but no luck. I can download a file from the same URL without any problems. (replaced the actual urls details with ____) B4X: Dim job1,job2 As HttpJob Dim myurl,dlfilename,ulfiledir,lufilename As String job1.Initialize("Job1", Me) job2.Initialize("Job2", Me) myurl = "http://www.__________.com/_________/" dlfilename = "testdlfile.txt" ulfiledir = File.DirRootExternal ulfilename = "testulfile.txt" job1.Download(myurl&dlfilename) job2.PostFile(myurl,ulfiledir,ulfilename) What am I doing wrong (or omitting)?
Erel B4X founder Staff member Licensed User Longtime User Oct 7, 2012 #2 The file will not be uploaded without a server component (PHP script for example) that will read the data and save it. Upvote 0
The file will not be uploaded without a server component (PHP script for example) that will read the data and save it.
jpvniekerk Active Member Licensed User Longtime User Oct 7, 2012 #3 I'm not clued up on PHP or anything similar - is there any examples of how to do this available? Upvote 0
Erel B4X founder Staff member Licensed User Longtime User Oct 8, 2012 #4 This command will save the file: PHP: file_put_contents('test.txt', file_get_contents('php://input')); Upvote 0
This command will save the file: PHP: file_put_contents('test.txt', file_get_contents('php://input'));
jpvniekerk Active Member Licensed User Longtime User Oct 9, 2012 #5 Thanks Erel, I will give it a try. This will always save the file with the name "test.txt" (or whatever you put in the command). How can I save the file with the name of the file being uploaded (as named in b4a)? Upvote 0
Thanks Erel, I will give it a try. This will always save the file with the name "test.txt" (or whatever you put in the command). How can I save the file with the name of the file being uploaded (as named in b4a)?
Erel B4X founder Staff member Licensed User Longtime User Oct 9, 2012 #6 You can send the file name as a GET parameter. This will work even when you issue a POST request. Upvote 0
jpvniekerk Active Member Licensed User Longtime User Oct 9, 2012 #7 Thanks Erel, Don't quite know how to do that... I'll have to brush up on PHP some more!!! (I understand that PHP is not really part of this forum) Upvote 0
Thanks Erel, Don't quite know how to do that... I'll have to brush up on PHP some more!!! (I understand that PHP is not really part of this forum)