FileReference usage or download file using haxe


I have a question because I’m getting crazy.

I’m targeting HTML5-JS. I just want to do a simple thing. I manage to create a png base64 encoded string to send it to the server, so there I create a PNG file and it downloads it to the client. And here it is my problem: I can’t download it.

The file is well created on the server so it exists, but when I do Http.request to that file I returns with “onData” but it doesn’t download the actual file. (I’m returning it from .net with a ContentType application/png and using TransmitFile, but it doesn’t work).

I’ve tried also with FileReference, and when I use “download” function nothing happens apparently. It sends the request, the request return but nothing happens. What am I missing? Maybe it’s a stupid thing and I just get stuck, but I think I need some help.

Thank you in advance!

Sorry, I finally made it.

I just create the file first on the server and when I return with everything is correct, I use Lib.getUrl() to send it to another url where download exactly the file I just created. I keep the file name and then I download it from the server with a simple get call.

I used filesaver.js for this the last time I needed it, but I’d like to have better support in FileReference and Lime FileDialog in the long term :smiley: