问题
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