PHP上传问题

PHP上传问题,php,file,upload,Php,File,Upload,我在通过PHP上传到服务器时遇到了一些奇怪的问题 我得到文件的类型(工作正常,通过echo显示) 然后我做了一些比较,让他们上传或不上传,这里是允许的填充类型 if($file['size'] <= 52428800) { //50MB, and my file is about 2,5MB if($fileType == "nlpack" || $fileType == "nl2pkg" || $fileType == "nlpark") { $id = add_

我在通过PHP上传到服务器时遇到了一些奇怪的问题

我得到文件的类型(工作正常,通过echo显示)

然后我做了一些比较,让他们上传或不上传,这里是允许的填充类型

if($file['size'] <= 52428800) { //50MB, and my file is about 2,5MB
    if($fileType == "nlpack" || $fileType == "nl2pkg" || $fileType == "nlpark") {
        $id = add_to_db($file['name']); //Adding to database the name, this will return an id, it works
        if($id) {
            mkdir("uploads/".$id); //create a folder where to add the file, working fine!
            if(move_uploaded_file($file['tmp_name']), ".uploads/".$id."/".$file['name']) {
                echo "file uploaded correctly";
            }
            else {
                echo "has been an error"; //it enters here, while the other file types enters in the if()
            }
        }
        else {
            echo "Has been an error";
        }
    } else {
        //alert an error
    }
}

如果($file['size']请确保文件大小没有超过php.ini中的设置,否则文件将无法上传

upload_max_filesize integer
The maximum size of an uploaded file.

When an integer is used, the value is measured in bytes. Shorthand notation, as described in this FAQ, may also be used.
如果是muliple:

max_file_uploads integer
The maximum number of files allowed to be uploaded simultaneously. Starting with PHP 5.3.4, upload fields left blank on submission do not count towards this limit.

你能显示更多的代码吗?你问题中的代码看起来并没有影响你的问题。你有什么错误吗?给我们一些可以处理的东西不要显示任何php错误。我会编辑它并按我得到的方式放置所有的代码!给我一分钟,谢谢这两个!这段代码不能用于任何文件。
if(move\u uploaded\u file($file['tmp_name'],“.uploads/”$id.“/”$file['name']){
应该给出一个错误。如果(move_uploaded_file($file['tmp_name'],“.uploads/”$id.“/”$file['name']),则应该是
{
add_to_db将文件名插入数据库,并返回自动生成的id。工作正常,始终使用mkdirOK中返回的id创建文件夹,在我的本地主机中仅为2MB。这就是为什么…谢谢!
max_file_uploads integer
The maximum number of files allowed to be uploaded simultaneously. Starting with PHP 5.3.4, upload fields left blank on submission do not count towards this limit.