Yii widget wrapper for Plupload: http://www.plupload.com/ Allows you to upload files using HTML5 Gears, Silverlight, Flash, BrowserPlus or normal forms, providing some unique features such as upload progress, image resizing and chunked uploads.
Documentation ¶
Requirements ¶
- Yii 1.1 or above
Installation ¶
- Extract the release file under
protected/extensions
Usage ¶
See the following code example:
$this->widget('application.extensions.Plupload.PluploadWidget', array(
'config' => array(
'runtimes' => 'flash',
'url' => '/image/upload/',
),
'id' => 'uploader'
));
Change Log ¶
- no updates coming for this widget (see comments)
- go here instead: https://github.com/enricodetoma/yii-plupload
February 13, 2010 ¶
- Initial release.
cant get file from drop.io
hi,
the pupload is great but i can't get the file update from http://drop.io/8nyaity/asset/plupload-zip , the file is protected and need password to access it. Could you please share the guest password, i really need the update. Thanks.
Custom Layout
I think you did a good job wrapping this script, but I also have the same problems with DIRECTORY_SEPARATOR.
Another thing is that like that you cannot change the layout to a custom uploader, so what you can do is add a property called custom, and then if it was set you could change the run method to what the custom was. Like that one can make their custom uploader and maybe use a renderPartial(that's what I did on my code).
Thanks for your work
Not so great
Uploadify is better, but flash only.
Watch out for the licence
A decent widget and plupload works really well, however it's GPL, so you'll have to open source all of your web app if you want to use it
url attribute
The url attribute is not the path where files will be uploaded but an url for the script that will handle the upload.
Also I can't find a way to get the uploaded files. There's not in $_FILES, $_POST or anywhere else
Small issues on windows
A lot of the URL paths use the "DIRECTORY_SEPARATOR", this caused some issues on windows. Changing this to "/" and things worked much better..
Updated version
I've finally put my updated version of this extension on GitHub:
https://github.com/enricodetoma/yii-plupload
@enrico.detoma Problems with controller action,jqueryUI does not work
Hi,great extension.I got it to work after I tweaked a little bit your controller action on github.There is a line
unlink($_FILES['file']['tmp_name']);
that will basically stop script execution without a @ at the beginning.
Also the block
if (isset($_SERVER['HTTP_CONTENT_DISPOSITION'])) { $arr = array(); preg_match('@^attachment; filename="([^"]+)"@',$_SERVER['HTTP_CONTENT_DISPOSITION'],$arr); if (isset($arr[1])) $originalname = $arr[1]; }
never gets executed so the original name gets lost.I had to add
$original_name= $_FILES['file']['name'];
to store the original name.
To move the uploaded files out of the temp directory I added
$temppath=$targetDir . DIRECTORY_SEPARATOR . $fileName; $app_root=substr( Yii::app()->baseUrl, 1, strlen(Yii::app()->baseUrl)-1); $dest= $_SERVER['DOCUMENT_ROOT'].DIRECTORY_SEPARATOR . $app_root.DIRECTORY_SEPARATOR. 'assets'.DIRECTORY_SEPARATOR. 'uploads'.DIRECTORY_SEPARATOR. 'pl'. DIRECTORY_SEPARATOR . $original_name; rename($temppath ,$dest);
Unfortunately,the jqueryUI option does not work for me.When set to true the widget appears 'naked' without table structure.The buttons still work but there is no layout.This is my widget configuration,any help is welcome.I am in windows.
$this->widget('application.widgets.plupload.PluploadWidget', array( 'config' => array( 'runtimes' => 'gears,flash,silverlight,browserplus,html5', 'url' => $this->createUrl('/pl/upload/'), //'max_file_size' => str_replace("M", "mb", ini_get('upload_max_filesize')), // 'max_file_size' => Yii::app()->params['maxFileSize'], 'max_file_size' => '1mb', 'chunk_size' => '1mb', 'unique_names' => true, 'filters' => array( array('title' => Yii::t('app', 'Images files'), 'extensions' =>'jpg,jpeg,gif,png'), ), 'language' => Yii::app()->language, 'max_file_number' => 10, 'autostart' => false, 'jquery_ui' => true, 'reset_after_upload' => true, ), 'callbacks' => array( 'FileUploaded' => 'function(up,file,response){console.log(response.response);}', ), 'id' => 'uploader' ));
Users saving model before files have finished uploading
I have reports from users that file uploads are 'not working', however I suspect that they're clicking 'Save' before the uploads have completed because it is not obvious to them that it hasn't completed... Yes, users can be a bit stupid sometimes!
However, it does strike me as a usability issue...
is there anyway I can disable the 'Save' or 'Create' button on a model form until all uploads have completed? I have tried the callback option, but this is fired after each upload completes, so doesn't solve the problem for multiple uploads...
Thanks in advance for any suggestions.
@streetdaddy
This widget never really worked out for me - server side not really compatible with what I wanted. I suggest using an Uploadify widget instead. Its flash only but then again HTML5 etc. browser support is poor.
Uploading docx, pptx, xslx, etc
I have plupload configuration as follows:
'filters' => array( array( 'title' => Yii::t('app', 'Activity documents'), 'extensions' => 'jpg,jpeg,gif,png,doc,docx,xls,xlsx,ppt,pptx,pdf,rtf' ), ),
however, on Chrome OSX all the .x file types cannot be selected by the user to be uploaded, ie docx, pptx, xslx...
has anyone experienced this issue and found a solution?
Recently upgraded this for a project needing IE7 uploads
Just so no one else has to go through the pain I just had to go through. I hope this helps someone.
https://github.com/woody1ks/Plupload.git
Update Comments:
upgraded to latest Plupload v1.5.7
Added preferred support for HTML5
removed redundant gears code thanks to browser plus
Added yii model support
Added HTML Attributes support.
<?php $this->widget('application.extensions.Plupload.PluploadWidget', array( 'config' => array( 'runtimes' => 'flash', 'url' => '/image/upload/', ), 'model'=>$model, 'attribute'=>'files', 'id' => 'uploader', 'htmlAttributes'=> array( 'class' => 'myUploaderClass', ), )); ?>
@woody1ks
Have you compared your code with the original one? 112 lines (your widget) versus 238 lines (original one). You have chopped-off half of the code, without giving even a tiny explanation, why?
Removing over 50% of the code, including some key functionality (
callback
for a good start) you call an update? Any reason or explanation, why you did that?If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.