COMMUNITY

Haxe php make post request body from streams (from file)

i have memory limit in server
and need to make big post request 50mb or more - it possible with haxe.Http reading data from file and write to http post?

found this https://api.haxe.org/haxe/Http.html#fileTransfer

but marked as deprecated

how to upload file by haxe? any example?

https://api.haxe.org/haxe/Http.html#fileTransfer isn’t marked as deprecated, only https://api.haxe.org/haxe/Http.html#fileTransfert

The difference in naming is subtle and can easily be missed :wink:

ok
where i can find example for upload file?

Don’t know of examples, but considering the arguments it should be something like this:

var http = new haxe.Http("url");
var file = "myfile.txt";
var input = sys.io.File.read(file);
http.fileTransfer("thePostVarName", file, input, sys.FileSystem.stat(file).size);
http.request(true);
input.close();
1 Like