This extension has been updated to use the V5 of the jquery plugin
jQuery file upload extension for Yii, allows your users to easily upload files to your server:
... 'import'=>array( 'application.models.*', 'application.components.*', ), 'aliases' => array( //assuming you extracted the files to the extensions folder 'xupload' => 'ext.xupload' ), 'modules'=>array(...
$this->widget('xupload.XUpload', array( 'url' => Yii::app()->createUrl("site/upload"), 'model' => $model, 'attribute' => 'file', 'multiple' => true, ));
Info: Ensure that the apache server has write permissions in the folder you are uploading the files, XUpload will try to create the upload folder if it doesn't exist already.
class SiteController extends CController { public function actions() { return array( 'upload'=>array( 'class'=>'xupload.actions.XUploadAction', 'path' =>Yii::app() -> getBasePath() . "/../uploads", 'publicPath' => Yii::app() -> getBaseUrl() . "/uploads", ), ); } }
public function actionIndex() { Yii::import("xupload.models.XUploadForm"); $model = new XUploadForm; $this -> render('index', array('model' => $model, )); }
Note: See the attached project for more examples
Released under the MIT license.
Total 20 comments
You can always create your own upload action, XUploadAction is just basic upload functionality.
Please use the forums for support.
And please try not to yell at me :)
what 's the destination file name . how can i get it ?
there is not a way to get dest file path ! unless you expose it as a XUploadAction's public variable . we often save it to database .
you should give this permission to us , but as your manners .
Styles are given by bootstrap CSS, styling is out of the scope of the extension, you can style the widgets any way you like, if you want the same styles as the demo check this post
It works fine in the demo. But each time I put it in my project. no css will appear.... any ideas?
Thanks for your words, they are very much appreciated, but please use the forum for support.
The reason the thumbs are not working in this demo, its because I didn't include the required files/logic, if you want to have thumbs, take a look at How to use image resizing functionality with the basic plugin
First of all... great extension! Many thanks for that. If it wasn't for this extension I wouldn't even know about this great jQuery plugin. Unfortunately, I have a minor problem with the thumbs that are not displayed when using this demo/plugin; however when using the original jQuery demo the result is slightly different...
Mac/Safari:
jQuery demo: after drop: thumbs no
jQuery demo: after upload: thumbs ok
vs
this demo: after drop: thumbs no
this demo: after upload: thumbs no
Mac/Firefox:
jQuery demo: after drop: thumbs ok
jQuery demo: after upload: thumbs ok
vs
this demo: after drop: thumbs ok
this demo: after upload: thumbs no
It doesn't seem to be a path issue because the images are uploaded properly and the link to the full-size image is working, too; only the thumbs won't show. Is this a matter of platform/browser or jQuery version (using 1.7.1)? Or am I missing something else?
Thanks for help.
when I'm using your uploader in Internet Explorer 8 and lower the uploader opens my download dialog downloading the index.php
It is not backwards compatible. the jquery plugin changed a lot.
I have the 0.2 version of your uploader is it ok if I overwrite the old XUploadAction with the new one?
try http://www.yiiframework.com/forum/index.php/topic/21284-xupload-update/page__view__findpost__p__143349
is that possible to use this widget inside a Cjuidialog widget
also..
list($name, $id) = $this->resolveNameID(); if (isset($this->htmlOptions['id'])) { $id=$this->htmlOptions['id']; } else { $this->htmlOptions['id']=$id; }
Hi afnan,
I'm sorry that no one replied to your post.
I order to receive better support, you may post to the extension forum thread, which I will receive a notification for. I don't log into the forums often. so I didn't know about your random thread.
If you are having trouble with the demo, It might be your local configuration, as the demo was tested before being uploaded, and no one else has mention issues with it before.
I would also recommend, to investigate a little more, before posting a question. in the resources section of this extension, there is a Wiki that answers many common questions, and has several examples, including one to yours.
This has nothing to do with the current extension. Its normal that many people over stackoverflow and forum have no experience with the current extensions. I can not understand why you mention this at all
The extension is open source and you contribute to it by giving a more details documentation. So go and do it.
Why do you thing this is related to the extension?
hi there This extension is great as people say but I am extremely frustrated by no help at forums over stackoverflow and Yii forums. Also I may be wrong but documentation is poor it should be detailed.
Secondly you would say try demo out ......And demo does not work either it does not uploads files just shows progress bar for 1-2 seconds and then vanishes.
I posted question and waited for whole 1 day and still no answer
http://www.yiiframework.com/forum/index.php?/topic/27918-upload-image-with-image-title/
Bundle of thanks for providing that extensions, thanks again and again
Thanks a lot for this extension!
In my LoadController/uploda action, I'm opening the file which has been uploaded and doing some validation on the actual contents of the file.
If I find errors, how do I send show those errors to the user?
Thanks Russell
The wiki for the original jquery plugin has been restored
https://github.com/blueimp/jQuery-File-Upload/wiki
You can find the answer to your specific need here
Hi, great module, thanks, but how do I manage multiple instances, I've just created 2 juidialog and load an xupload extencion on each one from diferent views, but when a add i file to the second xupload widget it is queued to the first xupload widget, so how do I add files to each one separately, thank you, and great extension.
Leave a comment
Please login to leave your comment.