Vue-element upload component, the official account of Wechat cannot get the original name of the file.

1. I use the upload component of vue-element to upload files, and the back end is php to receive files. It can be obtained normally on the computer browser, but in the mobile Wechat browser environment, the $_ FILES ["name"] obtained by the back end is a number, not the original name of the file. And the content-type of the header header is octet-stream
on the computer:

{"file":{"name":"223777351740402882.zip","type":"application\/zip","tmp_name":"\/tmp\/phpRpFMhW","error":0,"size":18920}}

WeChat end:

{"file":{"name":"931649","type":"application\/octet-stream","tmp_name":"\/tmp\/php93BlWy","error":0,"size":18920}}

html Code:

<el-upload class="upload-demo" action="__APP__/purchase1/uploadAnnex" :on-remove="handleRemove" multiple :data="{index: index}" :file-list="item.fileList" :on-success="annexSuccess" :before-upload="beforeUpload">
    <el-button size="small" type="primary"></el-button>
</el-upload>

php Code

        $result = array();
        if($_FILES["file"]["size"])
        {
            $newName = uniqid() . "." . $this->getExtension($_FILES["file"]["name"]);
            move_uploaded_file($_FILES["file"]["tmp_name"], C("UPLOAD_DIR") . "purchase/" . $newName);
            if(file_exists(C("UPLOAD_DIR") . "purchase/" . $name))
            {
                $result["status"] = "success";
                $result["index"] = $_REQUEST["index"];
                $result["info"] = C("MY_DOMAIN") . C("UPLOAD_DIR") . "purchase/" . $newName;
                $result["name"] = $newName;
            }
            else
            {
                $result["status"] = "error";
                $result["info"] = "";
            }
        }
        else
        {
            $result["status"] = "error";
            $result["info"] = "";
        }
        print_r(json_encode($result));
Nov.11,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e47b29-44c54.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e47b29-44c54.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?