开发者

If I used ftp_put to upload a file to an ftp server, how would I get the full url of the uploaded file?

开发者 https://www.devze.com 2023-01-04 03:15 出处:网络
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_ht

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)

0

精彩评论

暂无评论...
验证码 换一张
取 消