AFrenchCroissant Posted April 22, 2022 Share Posted April 22, 2022 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 comment Share on other sites More sharing options...
dmob Posted April 24, 2022 Share Posted April 24, 2022 Wild guess, shouldn't $sPD include the full path, as you did with $file? Link to comment Share on other sites More sharing options...
AFrenchCroissant Posted April 24, 2022 Author Share Posted April 24, 2022 i'm not sure ill try that but i took that from their api example Link to comment Share on other sites More sharing options...
AFrenchCroissant Posted April 24, 2022 Author Share Posted April 24, 2022 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 comment Share on other sites More sharing options...
argumentum Posted April 24, 2022 Share Posted April 24, 2022 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 my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
AFrenchCroissant Posted May 4, 2022 Author Share Posted May 4, 2022 ill look onto that Thanks Link to comment Share on other sites More sharing options...
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