SWFUpload

Hey, guys,

I’d like to know if somebody has worked with the SWFUpload plugin and Yii.

If so, could you please post some hint on how to start with or better way to implement? It’s just to share knowledgement.

Thanks in advance

:)

Hi Scoob I’m working on that using http://www.uploadify.com/

What I have done:

  1. download latest version from website and unzip under "extensions" directory

  2. in Uploadify directory create a file Uploadify.php like this:




class Uploadify extends CWidget {


        private $jBaseUrl;

        private $cssBaseUrl;


        public function init()

        {

        $this->jBaseUrl=Yii::app()->getAssetManager()->publish(dirname(__FILE__));

        //$this->cssBaseUrl=Yii::app()->getAssetManager()->publish(dirname(__FILE__).'/'.'css');

        $this->registerClientScript();


        parent::init();

        }


        protected function registerClientScript()

        {

        $cs = Yii::app()->clientScript;

        $cs->registerScriptFile($this->jBaseUrl.'/'.'swfobject.js');

        $cs->registerScriptFile($this->jBaseUrl.'/'.'jquery.uploadify.v2.1.0.min.js');


        $cs->registerScript('Uploadify',"$('#fileInput').uploadify({

                'uploader': '".$this->jBaseUrl."/uploadify.swf',

                'script': '/path/to/uploadify.php',

                'folder': '/path/to/uplaod/folder',

                'cancelImg': '".$this->jBaseUrl."/cancel.png',

                'multi' : 'true',

                });

        ");

        }

        public function run() {}

}



(I have a problem with ‘script’ value so I hope that someone help us to solve this problem…

  1. In your view put something like this:



$jqcs = $this->createWidget('application.extensions.Uploadify.Uploadify');


<p><strong>Multiple File Upload</strong></p>

<input id="fileInput" name="fileInput" type="file" /> <a href="javascript:$('#fileInput').uploadifyUpload();">Upload Files</a> | <a href="javascript:$('#fileInput').uploadifyClearQueue();">Clear Queue</a></div>



JS side works well. I have only problem that Uploadify doesn’t load ‘script’ value correctly and I hope someone will teach us how to solve that :)

hi guys,

I already have a uploadify working on my site, but I have not make it as an extension.

maybe this weekend I can upload it.

cheers.

hey isreal, I’m lookin forward to have a look at that code… I need to integrate uploadify too

thank you in advance…

Hwangar

finally

i create the extension at:

http://www.yiiframework.com/extension/uploadify/

this is a basic uploadify extension

I have this on my site, enable to replace images, once created, can save the image info to db and creating more images using the

http://www.yiiframework.com/extension/image/ extension

so if you need some similar to this just tell me.

cheers!

That’s great, guys, thank you very very much!!!!! Congratulations for that!

;>))

hope be useful,

anything about the plugin, just let me know.

did anybody 's got the 302 error -redirection? how did you get rid of it?

solved by cancelling accessControl on controller’s upload action