I have a strange problem. I've a form for upload file.
All is ok...but today I get error after upload:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
After some test, I see the problem is only for one of my files!
This file is a PDF.
I tried renaming it. no success. I tried to check online with a service if it is a valid PDF... it is valid. The file is not corrupted (i can view it)
If I zip it and upload all ok. Other files are ok to upload.... ONLY THIS SPECIFIC FILE CAUSE 500 ERROR!
I've also insert:
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);
at the begin of the index.php page...but I get always 500 error... no debug info showed to me...
What can be the problem? EVIL FILE?
My index.php is a standard upload script:
<?php
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);
// if I UNCOMMENT THIS 2 LINES, STILL GET 500 ERROR...VERY STRANGE AT THIS POINT
//var_dump($_FILES);
//exit();
if ( isset($_POST['action']) && $_POST['action'] == "upload" ) {
if ( isset($_FILES['file']) ) {
$upload = upload_file($_FILES['file']); //<-- my custom function to save to disk
if ( !$upload['Error'] ) {
// do some stuff
}
}
header("Location: ../");
exit();
}
UPDATE: some info. If I try it on localhost with WAMP server all ok. The error appear when I use it online
UPDATE 2: It is not a filesize problem. The problem appear only in one specific server...in others servers all ok: This is the log error from server: ModSecurity: Access denied with code 44 (phase 2). Match of "eq 0" against "MULTIPART_UNMATCHED_BOUNDARY" required. [file "/etc/httpd/conf.d/mod_security.conf"] [line "34"] [id "200003"] [msg "Multipart parser detected a possible unmatched boundary."]