Virtual Path
Posted: Thu Nov 14, 2002 7:35 am
Hi all..
I want all my uploaded files in another file system than the one the site is running. When I pass the absolute path as argument for move_uploaded_file function, everything is working fine. But, I want to use relative path. For that I have created a new alias called "userUploads" in apache. But, when I use this in the same function it is returning error. I know, to get the absolute path from a relative path there is a function called Server.MapPath in ASP. Is there any equivalent function in PHP. The main reason I am insisting on virtual path is the difference in file system of our test and live servers. Here is the working code.
When I change the $Path as
The upload fails.
Any help will be appreciated.
Thanks in advance.
-Abdul
I want all my uploaded files in another file system than the one the site is running. When I pass the absolute path as argument for move_uploaded_file function, everything is working fine. But, I want to use relative path. For that I have created a new alias called "userUploads" in apache. But, when I use this in the same function it is returning error. I know, to get the absolute path from a relative path there is a function called Server.MapPath in ASP. Is there any equivalent function in PHP. The main reason I am insisting on virtual path is the difference in file system of our test and live servers. Here is the working code.
Code: Select all
$Path= "/rw-root/data/b2bsite/userUploads/" . $_FILESї'ImageFile']ї'name'];
if (is_uploaded_file($_FILESї'ImageFile']ї'tmp_name']))
move_uploaded_file($_FILESї'ImageFile']ї'tmp_name'],$Path);Code: Select all
$Path= "/userUploads/" . $_FILESї'ImageFile']ї'name'];Thanks in advance.
-Abdul