[英]How to save an image to a subdomain from the root domain?
我需要上傳圖片並將其保存到子域。 如果上傳腳本位於根目錄下,是否可以這樣做? 這些是文件路徑:上傳腳本:
https://www.example.com/upload/save.php
圖像存儲:
http://imgs.example.com/temp
我的PHP:
$tempFolder = 'tempimages/';
$fh = fopen($tempFolder.$filename, 'w') or die("can't open file");
$stringData = base64_decode($base64image);
fwrite($fh, $stringData);
fclose($fh);
通常,具有子域的網站的結構是這樣的:
/home/xxxx/public_html/[subdomain]/
upload/
,則可以寫入../imgs/
。 它將進入主public_html
一個目錄,然后進入imgs
子域文件夾。 也可能是這樣的:
/home/xxxx/[subdomain]/
../../imgs
。 那去一個目錄最多public_html
再次,然后母公司public_html
,然后被其兄弟imgs
。 請注意,根據您的配置,子域文件夾可以在任何地方 。 這兩個例子是最常見的。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.