Smash multiple extensions down into a single one when accepting file

uploads.  Fixes #1872.
This commit is contained in:
Bharat Mediratta
2012-05-17 20:25:27 -07:00
parent 931da5f2ff
commit 9e2ea2ffed
6 changed files with 42 additions and 2 deletions

View File

@@ -63,6 +63,10 @@ class Uploader_Controller extends Controller {
$item->parent_id = $album->id;
$item->set_data_file($temp_filename);
// Remove double extensions from the filename - they'll be disallowed in the model but if
// we don't do it here then it'll result in a failed upload.
$item->name = legal_file::smash_extensions($item->name);
$path_info = @pathinfo($temp_filename);
if (array_key_exists("extension", $path_info) &&
in_array(strtolower($path_info["extension"]), array("flv", "mp4", "m4v"))) {