check/upload images to domain folder from subdomain

ε祈祈猫儿з 提交于 2019-12-24 03:38:14

问题


I have domain www.mysite.com and subdomain api1.mysite.com. There (in domain) are several folders and folder "images". There also is a folder called api1 which is subdomain's folder. What I can't figure out, is how to locate from subdomain a domian's folder "images" and upload files there or check if they exist. I'm using php. e.g.

this line is located in one of the files in subdomain folder and "images" folder is one level up - in domain folder.

$dir_img_small = file_exists('images/users/small/i_'.$profile_id.'.jpg');

I tryed to use ../ before images but it didn't work. Please help!

THANK YOU EVERYONE! I SOLVED IT MY SELF. ADDED ../../www IN FRONT OF images. NOTICED A SHORTCUT IN HOME DIRECTORY AND IT WORKED.


回答1:


Perhaps you should try to provide the full path to the directory:

$root_path = "enter root path here/";
$dir_img_small = file_exists($root_path . 'images/users/small/i_'.$profile_id.'.jpg');



回答2:


If you are using IIS you could define a "virtual" folder in one website that points to a physical folder somewhere on the server.

So you could define a virtual folder called "images" and map it to a physical folder that is the same folder as the images folder of another site.



来源:https://stackoverflow.com/questions/4164828/check-upload-images-to-domain-folder-from-subdomain

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!