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:

  http://www.domain.com/folder/file.txt

to this:

  ftp://user:p...@domain.com/webroot/folder/file.txt

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?

Jacqueline,

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 code):

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 content.

Jeff M.

_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to