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.

    评论

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料