When using the code example in /framework/forms/UploadField.php to upload multiple files the file uploads but the File Name is not set correctly in the Files Database Table.
'''What happens:'''
Go to Root.Files
Click 'Attach files from Computer' - ''note: no Upload Destination Folder dropdown is shown''
Select multiple jpeg files
Files Upload - Preview is shown
Files Complete Upload - Preview Disappears
Checking the Database Files Table 'File Name' is set to /assets/example.jpg ''(not /assets/Uploads/example.jpg)''
Checking server the file is in /assets/Uploads/example.jpg
'''Workaround:'''
Click edit within Upload Field
Change the folder to Uploads
Image now works correctly
<?php
/* /mysite/code/TestPage.php */
class TestPage extends Page
{
static $has_many = array(
'Images' => 'Image',
);
public function getCMSFields(){
$fields = parent::getCMSFields();
/* Example Code from https://github.com/silverstripe/sapphire/blob/master/forms/UploadField.php */
$UploadField = new UploadField('Images', 'Please upload some images <span>(max. 5 files)</span>');
$UploadField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif'));
$UploadField->setConfig('allowedMaxFileNumber', 5);
$fields->addFieldToTab('Root.Files', $UploadField);
/* End Example Code */
return $fields;
}
}
created by: Emaster created at: 2012-07-07 original ticket: http://open.silverstripe.org/ticket/7631
When using the code example in /framework/forms/UploadField.php to upload multiple files the file uploads but the File Name is not set correctly in the Files Database Table.
'''What happens:'''
'''Workaround:'''