首頁 >後端開發 >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