protected function getUploadFields() { if (isset($_REQUEST['album'])) { SWFUploadConfig::addPostParam('AlbumID', $_REQUEST['album']); $album_name = DataObject::get_by_id("ImageGalleryAlbum", $_REQUEST['album'])->AlbumName; } else { $album_name = ""; } return new FieldSet(new HeaderField($title = sprintf(_t('ImageGalleryManager.UPLOADIMAGESTO', 'Upload Images to "%s"'), $album_name), $headingLevel = 2), new HeaderField($title = _t('ImageGalleryManager.UPLOADFROMPC', 'Upload from my computer'), $headingLevel = 3), new SWFUploadField("UploadForm", "Upload", "", array('file_upload_limit' => $this->getUploadLimit(), 'file_queue_limit' => $this->getUploadLimit(), 'browse_button_text' => _t('ImageGalleryManager.UPLOADIMAGES', 'Upload Images') . '...', 'upload_url' => Director::absoluteURL('ImageGalleryManager_Controller/handleswfupload'), 'required' => 'true'))); }
static function addFileType($type) { if (self::$file_types_list == '*.*') { self::$file_types_list = ''; } $file_str = '*.' . str_replace('.', '', strtolower($type)) . ';' . '*.' . str_replace('.', '', strtoupper($type)) . ';'; if (stristr(self::$file_types_list, $file_str) === false) { self::$file_types_list .= $file_str; } }
function __construct($form_name, $name, $title = null, $configuration = array()) { parent::__construct($name, $title); if (isset($value)) { $this->value = $value; } SWFUploadConfig::$form_name = $form_name; if (!empty($configuration)) { SWFUploadConfig::Configure($configuration); } $url = SWFUploadConfig::get_var('upload_url'); if (empty($url)) { SWFUploadConfig::set_var('upload_url', Director::absoluteURL(Controller::curr()->Link('handleswfupload'))); } SWFUploadConfig::Bootstrap(); }
function __construct($controller, $name, $fields, $validator, $readonly, $dataObject) { parent::__construct($controller, $name, $fields, $validator, $readonly, $dataObject); // Hack! Requirements::block('jsparty/prototype.js'); if ($name == "UploadForm" && !isset($_POST['uploaded_files']) && $controller->Can('upload')) { SWFUploadConfig::bootstrap(); } Requirements::javascript('dataobject_manager/javascript/filedataobjectmanager_popup.js'); }
<?php SWFUploadConfig::Configure(array('upload_url' => Director::absoluteURL('SWFUploadControls/handleswfupload'), 'file_post_name' => 'swfupload_file', 'post_params' => '', 'file_size_limit' => str_replace("M", "MB", ini_get('upload_max_filesize')), 'file_types' => '*.*', 'file_types_description' => '', 'browse_button_text' => 'Browse...', 'file_upload_limit' => '100', 'file_queue_limit' => '100', 'required' => 'false', 'swfupload_loaded_handler' => 'swfUploadLoaded', 'file_dialog_start_handler' => 'fileDialogStart', 'file_queued_handler' => 'fileQueued', 'file_queue_error_handler' => 'fileQueueError', 'file_dialog_complete_handler' => 'fileDialogComplete', 'upload_start_handler' => 'uploadStart', 'upload_progress_handler' => 'uploadProgress', 'upload_error_handler' => 'uploadError', 'upload_success_handler' => 'uploadSuccess', 'upload_complete_handler' => 'uploadComplete', 'flash_url' => Director::absoluteURL('swfupload/javascript/swfupload.swf'), 'swfupload_element_id' => 'flashUI', 'degraded_element_id' => 'degradedUI', 'progress_target' => 'fsUploadProgress', 'upload_successful' => 'false', 'button_image_url' => Director::absoluteURL('swfupload/images/upload_button.png'), 'button_placeholder_id' => 'spanButtonPlaceholder', 'button_width' => '180', 'button_height' => '24', 'button_text_style' => '.button { font-family: Helvetica, Arial, sans-serif; font-size: 12px; }', 'button_text_top_padding' => '6', 'button_text_left_padding' => '6')); Director::addRules(10, array('swfuploadfile/$Action/$Class/$ID/$Field' => 'SWFUploadFileIFrameField_Uploader'));