function myCallback(data, errno,path)
if errno == 0 then
triggerEvent("onFileTDownload", root, "sound.mp3", data);
else
outputChatBox ('Error '..errno) --it return error 7, when ip == localhost returns error 1006
end
end
addEvent("onFileTDownload", false);
addEventHandler("onFileTDownload", root,
function(path,data)
local file;
if not fileExists(path) then file = fileCreate(path);
else file = fileOpen(path); end;
fileWrite(file, data);
fileClose(file);
-- do whatever with the file ...
end);
function testdownload ()
fetchRemote("http://127.0.0.1:80/testressource/sound.mp3",myCallback, "", false,':testressource/sound.mp3');
--[[i tried the following two examples too...
fetchRemote("http://localhost/testressource/sound.mp3",myCallback, "", false,':testressource/sound.mp3');
fetchRemote("http://localhost:80/testressource/sound.mp3",myCallback, "", false,':testressource/sound.mp3'); ]]
end
addCommandHandler ('tts',testdownload)
--[[ All in the client side]]
How to solve it?
can someone help me pls