mirror of
https://github.com/silverstripe/silverstripe-reports
synced 2024-10-22 11:05:53 +02:00
Fixed file upload issues when open_basedir restriction is enabled.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@40603 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
2748b0e81b
commit
15d8a4b8f6
@ -137,11 +137,25 @@ HTML;
|
||||
if($data['ID'] && $data['ID'] != 'root') $folder = DataObject::get_by_id("Folder", $data['ID']);
|
||||
else $folder = singleton('Folder');
|
||||
|
||||
$warnFiles = array();
|
||||
$newFiles = array();
|
||||
$fileSizeWarnings = '';
|
||||
$uploadErrors = '';
|
||||
|
||||
foreach($processedFiles as $file) {
|
||||
if($file['error'] == UPLOAD_ERR_NO_TMP_DIR) {
|
||||
$status = 'bad';
|
||||
$statusMessage = 'There is no temporary folder for uploads. Please set upload_tmp_dir in php.ini.';
|
||||
break;
|
||||
}
|
||||
|
||||
if($file['tmp_name']) {
|
||||
// Workaround open_basedir problems
|
||||
if(ini_get("open_basedir")) {
|
||||
$newtmp = TEMP_FOLDER . '/' . $file['name'];
|
||||
move_uploaded_file($file['tmp_name'], $newtmp);
|
||||
$file['tmp_name'] = $newtmp;
|
||||
}
|
||||
|
||||
// check that the file can be uploaded and isn't too large
|
||||
|
||||
$extensionIndex = strripos( $file['name'], '.' );
|
||||
@ -175,7 +189,7 @@ HTML;
|
||||
$numFiles = sizeof($newFiles);
|
||||
$statusMessage = "Uploaded $numFiles files";
|
||||
$status = "good";
|
||||
} else {
|
||||
} else if($status != 'bad') {
|
||||
$statusMessage = "There was nothing to upload";
|
||||
$status = "";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user