首页 >后端开发 >php教程 >php的move_uploaded_file一直返回false

php的move_uploaded_file一直返回false

WBOY
WBOY原创
2016-06-02 11:32:221619浏览

phpfilemove

<code> <form action="?action=save&type=image&style=boolblue&language=zh-cn" method="post" name="myform" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="width:100%"> <input type="file" name="uploadfile" size="1" style="width:100%">
</form>
<?phpfunction DoSave(){    if($_FILES['uploadfile']['error'] != UPLOAD_ERR_OK){        switch((int)$_FILES['uploadfile']['error']){        case UPLOAD_ERR_NO_FILE:            OutScript("parent.UploadError('lang[\"ErrUploadInvalidFile\"]')");            break;        case UPLOAD_ERR_FORM_SIZE:             OutScript("parent.UploadError('lang[\"ErrUploadSizeLimit\"]+\":".$GLOBALS["nAllowSize"]."KB\"')");            break;        }        exit;       }    preg_match("/\.([a-zA-Z0-9]{2,4})$/",$_FILES['uploadfile']['name'],$exts);    CheckValidExt($exts[1]);    $GLOBALS["sSaveFileName"] = GetRndFileName(strtolower($exts[1]));    $GLOBALS["sOriginalFileName"] = $_FILES['uploadfile']['name'];    $sFileName = str_replace('\\','\\\\',realpath($GLOBALS["sUploadDir"]))."/";    $sFileName .= $GLOBALS["sSaveFileName"];    if(!move_uploaded_file($_FILES["uploadfile"]["tmp_name"],$sFileName)){        OutScript("parent.UploadError('Error')");到这就退出了        exit;    }    。。。。。。。    ?></code>
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn