[Extension] Xupload
#41
Posted 24 August 2011 - 12:39 AM
Unfortunately my client is using shared hosting and wants to be able to upload substantial files. I'll have to figure something else out or convince him to move to a VPS.
Cheers.
#42
Posted 11 September 2011 - 02:03 PM
like:
Imagem = new Imagem;
imagem = post;
imagem.save();
in witch contronller i put it ?
#43
Posted 23 September 2011 - 02:03 PM
Can somebody tell me how to use xupload with the UI parameters?
I need to show one small thumb of the image sent and didn“t understand how it works with Yii.
Thanks
Leo
#44
Posted 02 October 2011 - 03:17 PM
model : [ my $model is the user model in my app]
<?php $this->widget('ext.xupload.XUploadWidget', array( 'url' => Yii::app()->createUrl("User/Upload/".$model->id), 'model' => $model, 'attribute' => 'Avatar', )); ?>
controller :
public function actionUpload($id) { $model = $_POST['User']; $fileName= $model->Avatar; }
any idea how can i get the name of uploaded file for example ? or any other feature like size and the upalod in in my own folder
Software engineer
T: +(961) 03 497265
E: kareemzok@gmail.com
Skype: kareem_zok



About me.com
#45
Posted 03 October 2011 - 09:23 AM
Relatively new to Yii I wonder how to get the xupload extension running under a module.
I currently have the extension in de app extensions folder, and the controllers/views too. And it works.
When I put the same controller/view behaviors inside a module, and click the green upload file button and select a file,
it won't show the response below the button as before. So i think it breaks there.
Flow:
the widget form action refers to cms/gallery/upload
The upload action in the gallery controller is the same as before (when it worked)
So my question is, does it work differently when accessed from a module? And should the above situation work the same?
#46
Posted 11 October 2011 - 06:56 AM
Is this extension updated?
The demo and the extension looks different when i implemented it
#47
Posted 11 October 2011 - 07:57 AM
Shah, on 11 October 2011 - 06:56 AM, said:
Is this extension updated?
The demo and the extension looks different when i implemented it
The Yii extension uses V4 of the plugin, while there is a V5 now, so far I have no intention to update. Will do so If I get enough requests to do so.
- Extension: XUpload - jQuery File Upload Extension
- Extension: PhpQuickProfiler - A Web Log Router that will help you profile your application
- Extension: XDateView - A Date grouped Grid View
- Extension: Foundation - An easy to use, powerful, and flexible framework for building prototypes and production code on any kind of device.
- Wiki: How to generate Yii like Documentation
- Wiki: How to re enable logging during unit testing
#48
Posted 05 November 2011 - 04:45 PM
I've installed this extension but it seems I get the none javascript version? Why is this happening?
Take a look at the included image. I've checked and jquery is loaded...
Attached File(s)
-
Screen Shot 2011-11-05 at 11.44.14 PM.png (15.44K)
Number of downloads: 94
#49
Posted 05 November 2011 - 09:10 PM
Bymannan, on 05 November 2011 - 04:45 PM, said:
I've installed this extension but it seems I get the none javascript version? Why is this happening?
Take a look at the included image. I've checked and jquery is loaded...
check firebug, you probably have some broken javascript, that is preventing the plugin from executing
- Extension: XUpload - jQuery File Upload Extension
- Extension: PhpQuickProfiler - A Web Log Router that will help you profile your application
- Extension: XDateView - A Date grouped Grid View
- Extension: Foundation - An easy to use, powerful, and flexible framework for building prototypes and production code on any kind of device.
- Wiki: How to generate Yii like Documentation
- Wiki: How to re enable logging during unit testing
#50
Posted 12 November 2011 - 08:56 AM
please any one tell me how to use this extension with send file and text data (Name,address) with single button. I already have form, I just want to send file and that data as ajax request
#51
Posted 23 November 2011 - 07:35 AM
Firstly, thank you for creating and sharing such a beautiful extension!
I have one problem, and one question:
The problem I have is this extension doesn't work for me when I try to add the widget to an existing page. The Apache error I get is:
Call to a member function getType() on a non-object in /var/vhosts/test.local/www/protected/extensions/xupload/actions/XUploadAction.php on line 120
Everything works fine if I place the widget in its own view.
The question I have is: how do I theme the widget like the demo application (i.e. in the demo app you can select a theme from dropdown)?
Any help would be really appreciated.
Thanks.
#52
Posted 23 November 2011 - 08:03 AM
public function actionCreate() { $model=new DevRequest; $uploadModel = new XUploadForm; ... ... $this->render('create',array( 'model'=>$model, 'uploadModel' => $uploadModel, ));
(then don't forget to pass $updateModel in your views/partial views too!!)
Also, you have to allow access to the 'upload' action in accessRules():
return array( array('allow', // allow all users to perform 'index' and 'view' actions 'actions'=>array('index','view', 'upload'), 'users'=>array('*'), ),
Still leaves my other question: how to theme XUploadWidget like the online demo (http://blueimp.githu...ry-File-Upload/)?
Thanks.
#53
Posted 23 November 2011 - 11:37 AM
Scott Deagan, on 23 November 2011 - 08:03 AM, said:
Thanks.
Hi there,
I'm not entirely sure, but you should check the source code in the demo, it uses some CSS on its own, you can also try to use a different JUI theme.
- Extension: XUpload - jQuery File Upload Extension
- Extension: PhpQuickProfiler - A Web Log Router that will help you profile your application
- Extension: XDateView - A Date grouped Grid View
- Extension: Foundation - An easy to use, powerful, and flexible framework for building prototypes and production code on any kind of device.
- Wiki: How to generate Yii like Documentation
- Wiki: How to re enable logging during unit testing
#54
Posted 30 November 2011 - 07:41 AM
#55
Posted 30 November 2011 - 09:25 AM
Scott Deagan, on 30 November 2011 - 07:41 AM, said:
Not possible, not with the limitations of a browser uploader functionality.Ive never seen anything like that. there is no way to know what files on a users folder.
and if you are talking about server folders, then why would like to "upload" files from one folder to another in the same server?
- Extension: XUpload - jQuery File Upload Extension
- Extension: PhpQuickProfiler - A Web Log Router that will help you profile your application
- Extension: XDateView - A Date grouped Grid View
- Extension: Foundation - An easy to use, powerful, and flexible framework for building prototypes and production code on any kind of device.
- Wiki: How to generate Yii like Documentation
- Wiki: How to re enable logging during unit testing
#56
Posted 24 January 2012 - 06:08 PM
Secondly, I'm trying to implement error handling and error responses as shown in the demo (try uploading a file that is not JPG, GIF or PNG or a file size over 5Mb and see what I mean) but having a hell of a time as my jQuery and JavaScript knowledge is very limited at best.
I can see in the demo code that there are jQuery vars set which describe the errors...
var fileUploadErrors = { maxFileSize: 'File is too big', minFileSize: 'File is too small', acceptFileTypes: 'Filetype not allowed', maxNumberOfFiles: 'Max number of files exceeded', uploadedBytes: 'Uploaded bytes exceed file size', emptyResult: 'Empty file upload result' };
...but this isn't integrated in the XUpload extension and I'm not sure how or where it should be placed. I also can figure out that this line...
<td class="error" colspan="2"><span class="label important">Error</span> {%=fileUploadErrors[file.error] || file.error%}</td>
...needs to be added to the _getBuildUploadRow() _getBuildDownloadRow() methods in the XUploadWidget.php file, so does that mean the file.error data is coming from the JSON data in the action file?
Any help appreciated, thanks

#57
Posted 30 January 2012 - 11:36 AM
$model->mime_type = $model->file->getType(); $mimext = explode("/", $model->mime_type); $model->size = $model->file->getSize(); $model->name = $model->file->getName(); $model->extension = $model->file->getExtensionName(); $model->mime = $mimext[0];
#58
Posted 31 January 2012 - 10:14 AM
mikewalen, on 24 January 2012 - 06:08 PM, said:
Secondly, I'm trying to implement error handling and error responses as shown in the demo (try uploading a file that is not JPG, GIF or PNG or a file size over 5Mb and see what I mean) but having a hell of a time as my jQuery and JavaScript knowledge is very limited at best.
I can see in the demo code that there are jQuery vars set which describe the errors...
...but this isn't integrated in the XUpload extension and I'm not sure how or where it should be placed. I also can figure out that this line...
...needs to be added to the _getBuildUploadRow() _getBuildDownloadRow() methods in the XUploadWidget.php file, so does that mean the file.error data is coming from the JSON data in the action file?
Any help appreciated, thanks

Hi, I'm struggling also to make xupload my all in upload solution and I really think the upload action is quite basic compared to the php source file on the git repository of the jquery plugin.
My guess is to inspire ourselves with that code and adapt the XuploadAction before saving the file. But...not sure...
For example, I find the 'trim_file_name' function quite usefull in the case the filename lacks of extension or is messed up with dots. It can easily be part of the xupload controller action !
#59
Posted 31 January 2012 - 10:20 AM
Dinesh, on 12 November 2011 - 08:56 AM, said:
please any one tell me how to use this extension with send file and text data (Name,address) with single button. I already have form, I just want to send file and that data as ajax request
My guess is that you should have your main form with the data for your tables and have a field for your uploaded file.
On the other hand, you could have the xupload form apart and it will populate your other form on success upload.
That would be a kind of two steps procedures where you would commit the attachment of your file to its metadata (in this case your other form).
#60
Posted 31 January 2012 - 10:27 AM
//from blueimp private function trim_file_name($name, $type) { // Remove path information and dots around the filename, to prevent uploading // into different directories or replacing hidden system files. // Also remove control characters and spaces (\x00..\x20) around the filename: $file_name = trim(basename(stripslashes($name)), ".\x00..\x20"); // Add missing file extension for known image types: if (strpos($file_name, '.') === false && preg_match('/^image\/(gif|jpe?g|png)/', $type, $matches)) { $file_name .= '.'.$matches[1]; } return $file_name; }
then in the run function
$model->name = $this->trim_file_name($model->file->getName(), $model->file->getExtensionName() );