"Server.downloadFile" not working
-
Does anyone have an idea why the download is not working?
Thank you very much
OliHere is the snippet:
HiseSnippet 998.3ocsVstiZaDEdL65ph6E0HkG.K9kohxkkcyRSTT1.rzhZXCJjD0+EMLdLLZGOi0Li2DTDR8soud8Mn8L1FvjPZiPM9G6pybt8ctyTkjP0ZoB438xUITjy25NakvrbvRLSfFOD436pMogL4bkbFUcGUMPFGmJXDrgIEs6f5uJAq0zPjiyI+hUKmpmhx99qmzGywBBc2SHzqkLB8YrXlY2qSu52Xb9HbH8kr3RRe9UiIRw.IWlBH7D21nDL4V7B5MXqXUbQ+JVuD47itcogm0qG9hy61kz6m6Qtjf6QIcleY6yvQgc6QCmGd9EmiQNe00gLiTMyfMTMx4z9xvUyVJeqH2AuloYy4TKQGzLvy4OORxCsgn8UzfkLd3zMoNMBrxzcIxSxSj22cBKjs88cIzeHig+NMJm.cprO7NYO30oL7ZWBdG.RNkfzo4P5dtyHJVhYGGKd9F2wBCUEgg5TYnjKKpxeVwcfDjPXZFiukNRADa0H3Asa2vG9S8G44A0JswOUw8ereskFSh9gsZss6oofZZ81jehjarVlkzXpdG+Vr3Es3xExl56VT6Qd4caM0TSerl9pW7r.vxV2nnK7i.WLhwoyVoMz3lKnlrJjJnziCo5aMxj5VtY4GKufZacg0VLAmIn9QoBhsc1WJ5mZLRQGaHqj7.hLNQJ.71v+NLOkV268dU8pxhBJHqBzUKvZHTm3Rbti.z1v+8qa3G0Xq8C.4yTvG9.aXVxzMCwFbyHlfoWRCqWvbiPUAfnkbZyDESXJofNkXKh9Owu1P.f07enesQXF2FV4ptF9+ZK0ZOu0PrtoJZSGahpfZEwas51LcQTO.y4ygIsfOLc.VqTp5Fog9baLYSIq87+PVQQGjWgs3P05Prsq.T+aJFHRimSU6UP.Ag178mcb+zyNkGsK5GKInTLVvLOOgJ9TC7nhbocNq.UfnlroruuXJKOygXvvTU2hzHJCxkWGhd03gP4big.aB9IgpLLaH3LjdGrtLe7spaQGclrEEPXg1mgae2VW9G2d0pcDQWwzSjwfcvpU4Aqg9NvndtCK5kgsyezhDXElLLkiM6uWyt8ufATv1aYhcggPyLqJec3+skcetP7dtSYFxxCiwJG.iPY4KAFKNQ7ctWGEQIlc.7T2Q+9Wl6AnWHSMLwhIXihAsCt2jFOCNqRnf2EBJ2Nv3Tw1ZmS21Ray.ynhvLh+F9JX1wR6TvryFlnXLQIeCIefvdD5qydAvjH6fcU2IVZ+CLGDC2DeCgruo9HEO6XUr6wp34GqhWbrJ9fiUwKOVE68eqn8mr7zTiLNerAglL85r8VNNWKvPGXV2J5eLwgsKE
Here is the code:
const url = "https://studiobro.net/wp-content/themes/studiobro/img/logo.svg"; Server.setBaseURL(url); reg f = FileSystem.getFolder(FileSystem.Desktop).getChildFile("logo.svg"); inline function onButton1Control(component, value) { if(value) { Server.downloadFile(url, {}, f, function() { if(this.data.finished) { Console.print(this.data.success ? "Done" : "Fail"); } }); } }; Content.getComponent("Button1").setControlCallback(onButton1Control);
-
@Oli-Ullmann Your base url shouldn't be the same as the url.
In your case try something like this:
Server.setBaseURL("https://studiobro.net/"); const url = "wp-content/themes/studiobro/img/logo.svg";
-
@d-healey
Great, that worked. Thanks as always David! :-)