Home > Backend Development > PHP Tutorial > php的move_uploaded_file一直返回false

php的move_uploaded_file一直返回false

WBOY
Release: 2016-06-02 11:32:22
Original
1622 people have browsed it

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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template