问答详情
源自:1-3 $_FILES预定义变量解析

填相对路径会报错

move_uploaded_file($tmp_name,"uploads/".$filename) 我在uploads/这个地方只能填绝对路径,不然会报错,老师怎么设置的。

提问者:小往大来 2015-01-02 16:34

个回答

  • King
    2015-01-03 08:40:42

    不会啊,你把代码粘贴出来看看

    报的是目录没找到嘛?

    ^-^...

  • 小往大来
    2015-01-03 09:57:42

    是目录没找到,填完整就没问题了$path='F:/Demo/test02';

    如下:

     Warning: move_uploaded_file(test02/188.jpg): failed to open stream: No such file or directory in F:\Demo\test02\doAction2.php on line 23

    Warning: move_uploaded_file(): Unable to move 'F:\wamp\tmp\phpB264.tmp' to 'test02/188.jpg' in F:\Demo\test02\doAction2.php on line 23

    代码:

    ...

    $path='test02'; //line21

    $destination=$path.'/'.$fileInfo['name']; //line22

    if(move_uploaded_file($fileInfo['tmp_name'],$destination)){

    ...