dongyan7851 2017-03-18 07:59
浏览 39
已采纳

在sitepoint的AJAX文件上传示例中获取php代码问题

Can someone please help me to debug the php code in the post at https://www.sitepoint.com/html5-ajax-file-upload/ . PHP script here is no longer able to upload the file.

I tried this with my local server but the file is not uploading in upload folder.

Thanks in adv.

  • 写回答

1条回答 默认 最新

  • douxing6532 2017-03-18 11:17
    关注

    This tutorial is old. In file filedrag.js there is function function UploadFile(file) {....} in that change

    xhr.setRequestHeader("X_FILENAME", file.name);

    to

    xhr.setRequestHeader("X-FILENAME", file.name);

    since underscores are deprecated in later Apache releases, and ignores it, so there is error which is seen in console. For more (refer Header names with underscores ignored in php 5.5.1 / apache 2.4.6 )

    After changing it will upload to respective directory

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 maixpy训练模型,模型训练好了以后,开发板通电会报错,不知道是什么问题
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥30 vmware exsi重置后登不上
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容