Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions content/content.upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,14 @@ public function moveUploadedFiles()

foreach ($data['file'] as $i => $file) {

if (!$valid = $this->validateUploadedFile($file['tmp_name'], $file['name'], intval($file['error']))) {
// the /[%|&]/ list can be added to as seen fit
// this is done so that image srcs will not choke when trying to be displayed
// since a % sign is a special character for uris.
// just using a urlencode will convert % => %25 which has the same affect as above
// the urlencode will then at least handle spaces and replacing them with a + sign
$encoded_name = urlencode(preg_replace('/[%|&]/', '', $file['name']));

if (!$valid = $this->validateUploadedFile($file['tmp_name'], $encoded_name, intval($file['error']))) {
return $valid;
}

Expand All @@ -135,7 +142,7 @@ public function moveUploadedFiles()
}

try {
$new_file = $unique ? DirectoryTools::getUniqueName($file['name']) : $file['name'];
$new_file = $unique ? DirectoryTools::getUniqueName($encoded_name) : $encoded_name;
} catch (Exception $e) {
$this->handleGeneralError('fatal error: {$err}', array('err' => $e->getMessage()));
return false;
Expand Down