# sfSWFUpload - SWFUpload Multi Upload helper ## Author Mauro Casula ## Overview This plugin offers helpers that permit simple use and configuration of SWFUpload: a small JavaScript/Flash library for multi upload. More info over SWFUpload: http://swfupload.org/ You can use this plugin with included upload action or develop your own upload action. ## License For the full copyright and license information, please view the LICENSE file that was distributed with this source code. ## Requirements The following plugin is required from included sfSWFUpload/upload action (You can create your own): * sfThumbnailPlugin ## Compatibility Was tested against Symfony version 1.0.7 - 1.0.16 ## Change log v0.1.0: First beta release. Installation ## To install the plugin use: 1. symfony plugin-install http://plugins.symfony-project.com/sfSWFUploadPlugin 2. copy /plugins/sfSWFUploadPlugin/web/sfSWFUploadPlugin in your web folder. ## Configure Included upload action create the following structure: galleryFolder/thumbs_folder ( If create_thumb is true ) galleryFolder/images_folder Basic configuration is done in your application's app.yml file: app.yml: #SWF Options file_size_limit: "100 MB" #Upload file size limit (checked client side) file_types: "*.jpg;*.gif;*.png" #File types showed by file dialog file_types_description: "Supported Files" #File types Description file_upload_limit: 100 #Maximum number of files uploading file_queue_limit: 0 #Maximum number of files in queue debug: "false" #Debug flag ( true | false ) #Options for included upload action image_mime: image/jpeg #Image Mime type. Supported: 'image/jpeg', 'image/png', and 'image/gif' gallery_folder: uploads/gallery #Gallery Folder ( if not exists, plugin create that ) images_folder: big #Big Images folder image_width: 800 #Big Images width image_height: 600 #Big Images height image_quality: 100 #Big Images Quality create_thumb: true #If true, create thumbnails with following options thumbs_folder: small #Thumb Folder thumb_width: 320 #Thumb Width thumb_height: 200 #Thumb Height thumb_quality: 75 #Thumb Quality Using the plugin 1.Enable the module in your settings.yml if you want to use included upload action: {{ all: .settings: enabled_modules: [sfSWFUpload, ...](default,) }} 2. Clear the cache {{ $ symfony cc }} 3. Put the use_helper in your template {{ <?php use_helper('sfSWFUpload') ?> }} 4. Use the helpers: {{ <?php echo swf_upload_javascript("sfSWFUpload/upload"); ?> <?php echo swf_upload_standard_html(); ?> }} 5. Enjoy ;) ## Advanced Use UPLOAD ACTION This plugin come with a very simple upload action. You can develop your own upload action and pass it to 'swf_upload_javascript($action)' helper. LISTENERS SWFUpload offers a lot of listeners that you can use to offer a better user experience. Examples: multiUploadSuccess.php {{ <?php use_helper("SWFUpload", "Javascript"); ?> <?php echo swf_upload_javascript("sfSWFUpload/upload",array("PHPSESSID" => "NONE"), array()); ?> <div style="margin:20px; float: left; width: 400px;" > <?php echo swf_upload_standard_html(); ?> <?php echo javascript_tag( "function queueComplete() { new Ajax.Updater('preview', '".url_for('sfSWFUpload/showUploads')."', {asynchronous:true, evalScripts:false}); }" ) ?> </div> <div id="preview" style="float: left; width: 60%; margin: 20px;"> <?php include_partial('sfSWFUpload/simple_list_fotos', array('photos' => $photos, 'small_gallery_dir' => $small_gallery_dir )) ?> </div> }} This simple bit of code, make visible a list of uploaded files. When upload finish, queueComplete funcion is called.. queueComplete in this case is an Ajax function that refresh uploaded files. There are others 2 built-in examples. You can enable 'sfSWFUpload' plugin module from settings.yml and watch: * sfSWFUpload/SimpleMultiUpload * sfSWFUpload/FileSizeMultiUpload ## Contacts If you have any questions or feedback feel free to contact me at maurocasula at gmail.com or contact me from my blog: www.symfony-framework.com