Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/298.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php vue上载组件包发送空的$\u文件_Php_Wordpress_Vuejs2 - Fatal编程技术网

Php vue上载组件包发送空的$\u文件

Php vue上载组件包发送空的$\u文件,php,wordpress,vuejs2,Php,Wordpress,Vuejs2,我正在Wordpress的一些自定义代码上使用 在服务器上,如果我尝试打印($\u文件)我会得到: ( [name] => [type] => [tmp_name] => [error] => 4 [size] => 0 ) 如果我使用的是一个简单的,我会在服务器上获取数据,所以问题出在包上。我还发现这个包也有类似的问题。但我不知道如何实施 这是代码文件上传: &

我正在Wordpress的一些自定义代码上使用

在服务器上,如果我尝试
打印($\u文件)
我会得到:

    (
        [name] => 
        [type] => 
        [tmp_name] => 
        [error] => 4
        [size] => 0
    )
如果我使用的是一个简单的
,我会在服务器上获取数据,所以问题出在包上。我还发现这个包也有类似的问题。但我不知道如何实施

这是代码文件上传:

<div id="upload-files">
    <!-- display some date from file.. -->
    <file-upload
        extensions="jpg,jpeg,png,pdf"
        accept="image/png,image/jpeg,application/pdf"
        :multiple="true"
        :maximum="10"
        v-model="certifications"
        input-id="certifications"
        name="certifications"
        @input-filter="inputFilter"
        ref="upload">
        <a class="button button-secondary btn-modalities" style="margin-top:10px;"><i class="fa fa-plus" style="margin-right:5px;"></i>Select files</a>
    </file-upload>
</div>

<script>
    new Vue({
      el: '#upload-files',
      data: function () {
        return {
          certifications: []
        }
      },
      components: {
        FileUpload: VueUploadComponent
      },
      methods: {
        inputFilter(newFile, oldFile, prevent) {
          if (newFile && !oldFile) {
            if (/(\/|^)(Thumbs\.db|desktop\.ini|\..+)$/.test(newFile.name)) {
              return prevent()
            }
            if (/\.(php5?|html?|jsx?)$/i.test(newFile.name)) {
              return prevent()
            }
          }
          if (newFile && (!oldFile || newFile.file !== oldFile.file)) {
            newFile.blob = ''
            let URL = window.URL || window.webkitURL

            if (URL && URL.createObjectURL) {
              newFile.blob = URL.createObjectURL(newFile.file)
            }

            newFile.thumb = ''
            if (newFile.blob && newFile.type.substr(0, 6) === 'image/') {
              newFile.thumb = newFile.blob
            }

            console.log(this.certifications);
          }

        },
      }
    });
  </script>

选择文件
新Vue({
el:“#上传文件”,
数据:函数(){
返回{
证书:[]
}
},
组成部分:{
文件上载:VueUploadComponent
},
方法:{
inputFilter(新文件、旧文件、防止){
if(newFile&!oldFile){
if(/(\/^)(Thumbs\.db | desktop\.ini | \…+)$/.test(newFile.name)){
返回防止()
}
if(/\(php5?| html?| jsx?$/i.test(newFile.name)){
返回防止()
}
}
if(newFile&(!oldFile | | newFile.file!==oldFile.file)){
newFile.blob=“”
设URL=window.URL | | window.webkitURL
if(URL&&URL.createObjectURL){
newFile.blob=URL.createObjectURL(newFile.file)
}
newFile.thumb=“”
if(newFile.blob&&newFile.type.substr(0,6)==“image/”){
newFile.thumb=newFile.blob
}
console.log(这是一个证书);
}
},
}
});