0

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.

7
  • 1
    Have you checked the error logs? Commented Apr 16, 2019 at 16:34
  • People can help more if you share the code your using Commented Apr 16, 2019 at 16:36
  • Hi thanks, yes I already check them. Nothing on the error logs and nothing weird on the access log @JayBlanchard Commented Apr 16, 2019 at 16:37
  • @ArleighHix my code is nothing more than just showing all the previous variables on my topic and sending a basic form data. (By the way the console developers show that I have sent the request with all the informations) Commented Apr 16, 2019 at 16:39
  • Sounds like something in the server configuration is filtering out the post data for some reason. Commented Apr 16, 2019 at 17:19

1 Answer 1

0

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.

Sign up to request clarification or add additional context in comments.

3 Comments

That's an excellent question. Indeed my request is in multipart/form-data. Like I said, in some test it's working without any problem. Even if it's not working my developers console show me that my request is perfectly sent. Sorry about my english.
Sorry, I missed the part in your question where you said some of the files were getting through.
I'd fire up Fiddler and see whats different between the requests that do, and do not work. Unfortunately, this is probably going to be a maddening problem to solve, and the solution will turn out to be something really simple, and minor :(.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.