Search code examples
phprestler

parse file location dynamical to download


i am using restler framework,and have a class given below

class file {
function upload ($url= ' '){
    echo $url ;
}
}

i want to enter a link so that the server downloads the file based on a url, so if i put this in the browser

http://localhost/apiv1/file/upload?url=http://10.220.5.181/New%20folder/02%20Track%202.mp3

i get a response

Warning: parse_url(/apiv1/file/upload?url=http://10.220.5.181/New%20folder/02%20Track%202.mp3): Unable to parse URL in /usr/share/airtime/public/vendor/Luracast/Restler/Restler.php

So what does this mean, and how do i fix it?

PS: note that it does perform the function properly ( ie: it uploads the file)


Solution

  • Your URL is not vaild. You have to urlencode() the query values. Please try the following:

    http://localhost/apiv1/file/upload?url=http%3A%2F%2F10.220.5.181%2FNew%2520folder%2F02%2520Track%25202.mp3