du5407 2019-04-16 16:30
浏览 129

用php中的一些上传文件清空请求

I have a little problem about upload files in ajax. I sent a form-data to my backend server. The problem is that sometimes, depending on the files my backend doesn't receive anything. Nothing on $_REQUEST, nothing on $_POST, $_GET, $_FILES or even in file_get_contents(php://input).

I have already tried to put my memory_limit to -1 with post_max_size to 0 and my upload_max_filesize to 16M.

I tried with a small picture, an heavy one and one between the two. The small failed. The heavy and the other one are good.

Did any of you have a clue about this problem ?

Edit : I'm using angularJS (angular 1.x.x) on my front-end.

  • 写回答

1条回答 默认 最新

  • douyi1855 2019-04-16 17:22
    关注

    Did you set the form encoding type to multipart/form-data?

    <form action="foo.php" enctype="multipart/form-data" method="post">...
    

    You didn't say how you were sending the files to the server via AJAX, but this SO answer Angularjs $http post file and form data would probably be helpful to you.

    评论

报告相同问题?

悬赏问题

  • ¥30 求一段fortran代码用IVF编译运行的结果
  • ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
  • ¥15 lammps拉伸应力应变曲线分析
  • ¥15 C++ 头文件/宏冲突问题解决
  • ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
  • ¥50 安卓adb backup备份子用户应用数据失败
  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试,帮帮忙吧
  • ¥15 #MATLAB仿真#车辆换道路径规划