HI, I’ve some links to permit the visitor to download documents (zip files) from the server, I need to trigger if the file doesn’t exist to send him an alert but seems that the function getUrl() can’t have listeners or handlers.
The “easiest” is using sockets, but that might get heavy on the server if you have heavy traffic on your site. another way to do this is setting a timeout period.
Make an object that will load the target, and check to see if the target is loading (by checking if the totalBytesLoaded is greater than 4). If after X seconds (usually 4-7) it’s still 4 or lower, than it is not loading, and you can do whatever it is you want to do in that case.
an easy way to do this would be to make a php or asp download handler script. Therefore you could track how many times the file has been downloaded as well and store it in a database.
The way you would do this is do something like:
download.php?d=http://dljafjd.com/file.zip
then pass that string in the php file and redirect when your finished with the script. if the file doesnt exist it could take you to a “file not found” page.