Merge pull request #81 from nedmas/patch-3

ENHANCEMENT: Use File->Title to set default Title
This commit is contained in:
Thierry François 2014-07-24 14:29:03 +03:00
commit 7d74977491

View File

@ -156,15 +156,13 @@ class GridFieldBulkUpload_Request extends RequestHandler
$title = $record->getTitle(); $title = $record->getTitle();
if ( !$title || $title === $record->ID ) if ( !$title || $title === $record->ID )
{ {
$title = basename($uploadedFile->getFilename());
if ( $record->hasDatabaseField('Title') ) if ( $record->hasDatabaseField('Title') )
{ {
$record->Title = $title; $record->Title = $uploadedFile->Title;
$record->write(); $record->write();
} }
else if ($record->hasDatabaseField('Name')){ else if ($record->hasDatabaseField('Name')){
$record->Name = $title; $record->Name = $uploadedFile->Title;
$record->write(); $record->write();
} }
} }