For example, I use file_put()
to upload file.rar
to public_html/rar/
. Would开发者_如何学运维 it be possible for me to get the web address of that .rar file?
You'd have to know that ftp path /public_html/ is the document root for the website. Once you know that, you can just strip the FTP path down.
You can obviously do this for particular sites, but there's no real way to automatically determine the document root, so this can't be done automatically without asking the user where the document root is.
(I guess you could try to guess based on common paths like 'public_html' or 'www' or 'content', but you'd only be guessing and could be wrong)
精彩评论