BUGFIX Validating $_FILES in File::loadUploaded (Original patch was applied to Upload->validate() in trunk - r73254)

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.2@73279 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2009-03-18 02:49:13 +00:00 committed by Sam Minnee
parent c914013287
commit 33f2996ea3

View File

@ -160,6 +160,10 @@ class File extends DataObject {
if(!is_array($tmpFile)) user_error("File::loadUploaded() Not passed an array. Most likely, the form hasn't got the right enctype", E_USER_ERROR);
if(!$tmpFile['size']) return;
if(isset($tmpFile['tmp_name']) && !is_uploaded_file($tmpFile['tmp_name'])) {
user_error("File::loadUploaded() File is not a valid upload", E_USER_ERROR);
return false;
}
// @TODO This puts a HUGE limitation on files especially when lots
// have been uploaded.