A
A
Alexey2020-03-22 18:40:28
AJAX
Alexey, 2020-03-22 18:40:28

Why doesn't ajax pass anything when uploading large files?

There is a form for uploading a file (post method) to the server via ajax (we add a file in the review, write its new name and click "upload") For small php files, the script catches the file and writes it as it should, and when I upload files larger than 40 mb ( maybe even less than the threshold for an error), then the php script does not catch anything in the end, but var_dump($_REQUEST); shows array(0){}

What's the problem? Are there any restrictions on uploading large files? Own server (not hosting)

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry Kolyada, 2020-03-22
@dimqakolyada

The Web server may not be accepting a request for the file due to its size. For example, in nginx there is a setting 1
client_max_body_size 20M; to specify the maximum file size

A
AUser0, 2020-03-22
@AUser0

PHP has a post_max_size setting that controls the size of the data received via POST.
Try ini_set("post_max_size", "100M");it at the very beginning of the script that handles this AJAX request.
But most likely you need to change the configuration in php.ini, or write .htaccess for a specific directory, because ini_set () will work after the fact of transferring the file, when it's too late to rush about.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question