I'm trying to save Files on my Server. It works perfect with small files but not with large ones.
In JavaScript I'm sending the files with a XMLHttpRequest
as follows
var ajax = new XMLHttpRequest();
ajax.open('POST', configuration.backend + 'ajax/uploadVideo', true);
ajax.setRequestHeader('X-File-Name', input.files[0].name);
ajax.setRequestHeader('X-File-Size', input.files[0].size);
ajax.send(input.files[0]);
in PHP this script saves the input to the harddrive:
$filename = $_SERVER['HTTP_X_FILE_NAME'];
$extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
$new_filename = uniqid().'.'.$extension;
$fh = fopen(DOCROOT.'/public/videos/'.$new_filename, 'w');
fwrite($fh, file_get_contents('php://input'));
fclose($fh);
The script works perfectly with smaller files, but not with larger ones. It just creates a file with 0 Bytes. (8.7MB ist not working while 5.7MB works). I don't get any PHP errors. Error reporting level is E_ALL & ~E_DEPRECATED
.
I've also tried to increase the values of post_max_size
, upload_max_filesize
and memory_limit
, but no change made any effect.