gever1010 Posted November 8, 2012 Share Posted November 8, 2012 I have a question about syntax. I have an html anchor that calls a php file, while passing a file name. It works just as intended when it looks like this: <a href="http://www.mysite.com/direct_download.php?file=uploads/myfile.mp3">Download</a> But my mp3 files are on another server, so I want to reference the file using the url. Can I do that? It doesn't seem to work. Example: <a href="http://www.mysite.com/direct_download.php?file=http://www.myserver.com/uploads/myfile.mp3">Download</a> Ideas? Am I missing quotes or something in particular to be able to read it as a URL? Quote Link to comment https://forums.phpfreaks.com/topic/270479-referencing-a-url/ Share on other sites More sharing options...
requinix Posted November 8, 2012 Share Posted November 8, 2012 Make direct_download.php add the location itself. As in $location = "http://www.myserver.com/" . $_GET["file"]; By the way I hope you're validating that filename before blindly using it. Quote Link to comment https://forums.phpfreaks.com/topic/270479-referencing-a-url/#findComment-1391186 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.