douhao9203 2017-10-16 18:15
浏览 440

PHP文件上载tmp_name不存在

I'm trying to upload a screenshot with a file input and an ajax request. This is my request code:

  var formData= new FormData();
  formData.append('pictureFile', fileInput.files[0]);
  $.ajax({
                       url: 'data/Upload.php',
                       type: 'POST',
                       processData: false,
                       contentType: false,
                       data: formData,
                       success: function (result) {
                           console.log(result);
                       }
                   });

My php code:

$fileName = $_FILES['pictureFile']['tmp_name'];

echo $fileName;

move_uploaded_file($fileName,"dirname");

The upload doesn't seem to be working however, the echo shows me this:

/data/sites/web/hostname/tmp/phplywZbl

When I check this directory right after making the request, it's empty!

I checked the php.ini file and file uploads are definitely on (max size = 2M, screenshot is 25kb).

Does anyone know what's wrong?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 marlin编译错误,如何解决?
    • ¥15 有偿四位数,节约算法和扫描算法
    • ¥15 VUE项目怎么运行,系统打不开
    • ¥50 pointpillars等目标检测算法怎么融合注意力机制
    • ¥15 关于超局变量获取查询的问题
    • ¥20 Vs code Mac系统 PHP Debug调试环境配置
    • ¥60 大一项目课,微信小程序
    • ¥15 求视频摘要youtube和ovp数据集
    • ¥15 在启动roslaunch时出现如下问题
    • ¥15 汇编语言实现加减法计算器的功能