开发者

PHP uploading error on IIS 7

HI every1, im just new in PHP and here's my problem

I've tried to create a upload tool to manager all the upload file on server I'm using FancyUpload to upload file, and here's my problem:

$baseUrl = '/files/';
if(!is_dir($baseUrl))
    mkdir($baseUrl, 0777);
$filepath = $baseUrl . $_FILES['photoupload']['name'];
move_uploaded_file($_FILES['photoupload']['tmp_name'], $filepath);
chmod($baseUrl.$_FILES['photoupload']['name'], 0777);

The problem is that i want to upload to folder 'files' at the root of my project but it always upload file to my E:\files\ while my project is located in E:\My 开发者_Go百科Works\UploadTool\

Can any help plzzzz?


$filepath = $_SERVER['DOCUMENT_ROOT'] 
          . DIRECTORY_SEPARATOR       
          . $_FILES['photoupload']['name'];

Whereas $_SERVER['DOCUMENT_ROOT'] contains the absolute path of your "project" and DIRECTORY_SEPARATOR is a constant you should use when using WAMPP for development and LAMP for deployment.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜