AFrenchCroissant 0 Posted April 22 Share Posted April 22 Hello, it's your annoying newbie here And i (still) need help i'm trying to work on something that upload a file to anonfile (because it dosnt any sort of loging in) and i figured out this small code everything works fine up until i try to upload a file, and it just sratight up dosn't work and i get an error from the server ((10) ERROR_FILE_NOT_PROVIDED) so could someone help me code (probably too much useless things): #include <HTTP.au3> ; The data to be sent $sPD = 'file=@test.txt' $file = @ScriptDir & "/test.txt" ; Creating the object $oHTTP = ObjCreate("winhttp.winhttprequest.5.1") $oHTTP.Open("POST", "https://api.anonfiles.com/upload", False) $oHTTP.SetRequestHeader("Content-Type", "text/plain") ; Performing the Request $oHTTP.Send($sPD) $fileopen = FileOpen($file, 0) $oHTTP.Send(FileRead($fileopen)) MsgBox(4096, "test", FileRead($fileopen)) FileClose($fileopen) ; Download the body response if any, and get the server status response code. $oReceived = $oHTTP.ResponseText $oStatusCode = $oHTTP.Status If $oStatusCode <> 200 then MsgBox(4096, "Response code", $oStatusCode) EndIf ; Saves the body response regardless of the Response code $file = FileOpen("Received.html", 2) ; The value of 2 overwrites the file if it already exists FileWrite($file, $oReceived) FileClose($file) Thanks you all for your previous support on my previous posts Link to post Share on other sites
dmob 48 Posted April 24 Share Posted April 24 Wild guess, shouldn't $sPD include the full path, as you did with $file? Link to post Share on other sites
AFrenchCroissant 0 Posted April 24 Author Share Posted April 24 i'm not sure ill try that but i took that from their api example Link to post Share on other sites
AFrenchCroissant 0 Posted April 24 Author Share Posted April 24 i tried changing it to : $sPD = "file=@" & @ScriptDir & "\test.txt" But i think it's only the name of the file once it's uploaded I also found this library in java, ill try to reploduce the same script in autoit Link to post Share on other sites
argumentum 844 Posted April 24 Share Posted April 24 3 hours ago, AFrenchCroissant said: ill try to reploduce the same script in autoit Go by https://anonfiles.com/docs/api . Should not be that hard. There is a CURL UDF you can use. Have fun and share the final script Follow the link to see my signature's stuff.FAQ - Please Read Before Posting. Link to post Share on other sites
AFrenchCroissant 0 Posted May 4 Author Share Posted May 4 ill look onto that Thanks Link to post Share on other sites
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now