Converting HTTP to FTP URL

Jeffrey Massung massung at
Sun Aug 7 23:05:29 EDT 2011

On 08/07/2011 04:12 PM, J. Landman Gay wrote:
> I need a way to convert a web URL to a valid FTP URL. For example, 
> convert this:
> to this:
> Not all servers use "public_html" so I can't just hard-code that as 
> the web root. Is there a generic way to indicate the web folder on a 
> server, the same way a tilde indicates the user's home folder? Or any 
> other way to get the path?


This cannot be done unless you control the web server. A *lot* of web 
servers now-a-days are not Apache (and its derivatives), but rather 
routing servers like Django, Happstack, Snap, AllegroServe, etc. Routing 
web frameworks allow you to literally host source files anywhere. For 
example, using Happstack I can say something like (forgive the Haskell 

route =
   msum [ file "file.txt" $ serveFile "/home/someUsername/files/blah.wav" ]

As you can see, what was requested has absolutely nothing to do with 
what was actually served to the browser.

So, the only way you can begin to solve this issue is if you have direct 
access to the web server and know how it's routing and serving static 

Jeff M.

More information about the Use-livecode mailing list