I have managed to create an AS3 script that uses file.download(urlRequest); – this is working fine when referencing a location that is web accessible. Is it possible to get flash to reference a location on the server it resides? I want to make the files it has access to downloading as secure as possible.
I realise that I can reference a PHP file in the AS3 to initiate the download but this isn’t working when using a browser window within a Silverlight application so need the flash to do the downloading if possible.
Any help is highly appreciated.
Perhaps use an htaccess rule on the server? If the request originates from a different host / server then respond with a 403 error. If the request is from the same host / server then download the file?
For example:
This is not the most secure method of preventing access, as referrer headers can be spoofed or disabled in browsers.
Another idea:
The url for the file is pushed through a php script. If the ip address of the request is not in the database, then do not allow the file to be downloaded. Use your flash to post a request to the server with an ip address (the server adds the ip to a whitelist in a database), then perform your
file.download(urlRequest)?Again not the most secure as someone could post their ip, spoof their referrer header and THEN get the files…
Still, better than nothing.