Yii Framework Forum: [Extension] Xupload - Yii Framework Forum

Jump to content

  • (20 Pages)
  • +
  • « First
  • 6
  • 7
  • 8
  • 9
  • 10
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

[Extension] Xupload Rate Topic: ***** 1 Votes

#141 User is offline   ronyaja 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 02-March 12

Posted 23 June 2012 - 06:03 AM

Well, it had been four days since i posted here. Still waiting for guidance from the master.
0

#142 User is offline   Asgaroth 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 371
  • Joined: 17-July 09
  • Location:Bogota, Colombia

Posted 23 June 2012 - 01:29 PM

View Postronyaja, on 23 June 2012 - 06:03 AM, said:

Well, it had been four days since i posted here. Still waiting for guidance from the master.


What is it you don't understand?, what have you tried, just saying "is not working" doesn't help me help you.
- Extension: Dynamic DataProvider Behavior
- 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
0

#143 User is offline   jacmoe 

  • Elite Member
  • Yii
  • Group: Moderators
  • Posts: 2,601
  • Joined: 10-October 10
  • Location:Denmark

Posted 23 June 2012 - 03:19 PM

View Postronyaja, on 23 June 2012 - 06:03 AM, said:

Well, it had been four days since i posted here. Still waiting for guidance from the master.


Questions are not like wine - they don't improve by age. ;)

"Doesn't work" doesn't work.
"Less noise - more signal"
0

#144 User is offline   ungaro 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 10-July 10

Posted 11 July 2012 - 05:58 AM

Hi,

how can i change maxNumberofFiles after initialization?

Let's say i have a checkbox that's allowing a visitor to upload more than one files if clicked.
So i might want to bing a behaviour to that checkbox that changes maxNumberofFiles to 1 or 7.

is this possible?

thanks,
alp
0

#145 User is offline   Asgaroth 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 371
  • Joined: 17-July 09
  • Location:Bogota, Colombia

Posted 11 July 2012 - 09:26 AM

View Postungaro, on 11 July 2012 - 05:58 AM, said:

Hi,

how can i change maxNumberofFiles after initialization?

Let's say i have a checkbox that's allowing a visitor to upload more than one files if clicked.
So i might want to bing a behaviour to that checkbox that changes maxNumberofFiles to 1 or 7.

is this possible?

thanks,
alp


Please check the widget options, the option you need its.

maxNumberOfFiles

This option limits the number of files that are allowed to be uploaded using this widget.
By default, unlimited file uploads are allowed.

Type: number
Example: 10

- Extension: Dynamic DataProvider Behavior
- 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
0

#146 User is offline   VinodC 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 30-April 12

Posted 13 July 2012 - 01:28 AM

View PostAsgaroth, on 11 July 2012 - 09:26 AM, said:

Please check the widget options, the option you need its.

maxNumberOfFiles

This option limits the number of files that are allowed to be uploaded using this widget.
By default, unlimited file uploads are allowed.

Type: number
Example: 10


Thanks!!!

Where will we include these option in xupload? in widget or in separate js code ?

i tried

<?php Yii::app()->clientScript->registerScript('script', <<<JS
    $('#images-form').fileupload({
    singleFileUploads: true
});
JS
, CClientScript::POS_READY);?>


in view and

            <?php
            $this->widget( 'xupload.XUpload', array(
                'url' => Yii::app( )->createUrl( "/site/upload"),
                //our XUploadForm
                'model' => $photos,
                //We set this for the widget to be able to target our own form
                'htmlOptions' => array('id'=>'images-form'),
                'attribute' => 'file',
                //'multiple' => true,
                'formView' => 'application.views.site._form',
                'singleFileUploads' => true,
                )    
            );
            ?>

Also tried 'singleFileUploads' in 'htmlOptions'
but all not worked for me..
0

#147 User is offline   Asgaroth 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 371
  • Joined: 17-July 09
  • Location:Bogota, Colombia

Posted 13 July 2012 - 09:25 AM

View PostVinodC, on 13 July 2012 - 01:28 AM, said:

Thanks!!!

Where will we include these option in xupload? in widget or in separate js code ?

i tried

<?php Yii::app()->clientScript->registerScript('script', <<<JS
    $('#images-form').fileupload({
    singleFileUploads: true
});
JS
, CClientScript::POS_READY);?>


in view and

            <?php
            $this->widget( 'xupload.XUpload', array(
                'url' => Yii::app( )->createUrl( "/site/upload"),
                //our XUploadForm
                'model' => $photos,
                //We set this for the widget to be able to target our own form
                'htmlOptions' => array('id'=>'images-form'),
                'attribute' => 'file',
                //'multiple' => true,
                'formView' => 'application.views.site._form',
                'singleFileUploads' => true,
                )    
            );
            ?>

Also tried 'singleFileUploads' in 'htmlOptions'
but all not worked for me..


XUpload its a CJuiInputWidget, you use it and pass js options as you would with the options param
- Extension: Dynamic DataProvider Behavior
- 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
0

#148 User is offline   VinodC 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 30-April 12

Posted 17 July 2012 - 06:32 AM

View PostAsgaroth, on 13 July 2012 - 09:25 AM, said:

XUpload its a CJuiInputWidget, you use it and pass js options as you would with the options param


Worked !!!
Thank You very much Asgaroth..
0

#149 User is offline   Philipp 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 13-July 12

Posted 18 July 2012 - 04:38 AM

Hey Asgaroth,

first let me thank you for the creation of this very useful extension!

After some trying around I managed to get everything working as expected apart from one feature: I can not validate the file type as done by others here in the thread or as described in the jQuery plugins docs.

My widget is called like this:
<?php
$this->widget('xupload.XUpload', array(
                    'url' => Yii::app()->createUrl('members/default/upload', array('id'=>$model->id)),
                    'model' => $upload,
                    'attribute' => 'file',
                    'multiple' => true,
	                'options' => array(
	                	'maxFileSize'=>3000000,
						'acceptFileTypes' => "/(\.|\/)(gif|jpe?g|png)$/i",
					),
));
?>


The jQuery generated for xUpload is as follows:

jQuery('#XUploadForm-form').fileupload({'maxFileSize':3000000,'acceptFileTypes':'/(\\.|\\/)(gif|jpe?g|png)$/i','url':'/members/default/upload/id/26'});


However, attaching any file that should validate (or any other) results in the following error in my console:

Quote

jquery.fileupload-ui.js:394 – TypeError: 'undefined' is not a function (evaluating 'this.options.acceptFileTypes.test(file.type)')


Any ideas why that happens? I'm kind of stuck here ;). Once I delete the 'acceptFileTypes' line, everything works, just no validaiton of file types which is kind of important. Thanks in advance!

Best,
Philipp
0

#150 User is offline   Asgaroth 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 371
  • Joined: 17-July 09
  • Location:Bogota, Colombia

Posted 18 July 2012 - 09:10 AM

View PostPhilipp, on 18 July 2012 - 04:38 AM, said:

Hey Asgaroth,

first let me thank you for the creation of this very useful extension!

After some trying around I managed to get everything working as expected apart from one feature: I can not validate the file type as done by others here in the thread or as described in the jQuery plugins docs.

My widget is called like this:
<?php
$this->widget('xupload.XUpload', array(
                    'url' => Yii::app()->createUrl('members/default/upload', array('id'=>$model->id)),
                    'model' => $upload,
                    'attribute' => 'file',
                    'multiple' => true,
	                'options' => array(
	                	'maxFileSize'=>3000000,
						'acceptFileTypes' => "/(\.|\/)(gif|jpe?g|png)$/i",
					),
));
?>


The jQuery generated for xUpload is as follows:

jQuery('#XUploadForm-form').fileupload({'maxFileSize':3000000,'acceptFileTypes':'/(\\.|\\/)(gif|jpe?g|png)$/i','url':'/members/default/upload/id/26'});


However, attaching any file that should validate (or any other) results in the following error in my console:



Any ideas why that happens? I'm kind of stuck here ;). Once I delete the 'acceptFileTypes' line, everything works, just no validaiton of file types which is kind of important. Thanks in advance!

Best,
Philipp


Hi there, check this previous post, you should add js: to the string
- Extension: Dynamic DataProvider Behavior
- 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
0

#151 User is offline   giantdut 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 24-April 12
  • Location:Jakarta, Indonesia

Posted 18 July 2012 - 11:23 AM

Hello,

I have installed this ext and success to upload,

I'm followed this http://www.yiiframew...pload-workflow/ to input value from another field to database

but i still not success with that...

My Submit button doesn't work. anyone can help me?
Try to explore my intellectual capital
0

#152 User is offline   Asgaroth 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 371
  • Joined: 17-July 09
  • Location:Bogota, Colombia

Posted 18 July 2012 - 01:47 PM

View Postgiantdut, on 18 July 2012 - 11:23 AM, said:

Hello,

I have installed this ext and success to upload,

I'm followed this http://www.yiiframew...pload-workflow/ to input value from another field to database

but i still not success with that...

My Submit button doesn't work. anyone can help me?


Whats the problem? please elaborate so that we can help you
- Extension: Dynamic DataProvider Behavior
- 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
0

#153 User is offline   giantdut 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 18
  • Joined: 24-April 12
  • Location:Jakarta, Indonesia

Posted 18 July 2012 - 11:20 PM

First problem solved, i directing the code in after save from the example to the main controller.

And now i got problem, becouse my form will upload 2 type of data
1. img -> for cover url
2. mp3 -> for music

xupload override all files form so i must do a validation before i save.
Try to explore my intellectual capital
0

#154 User is offline   fpolli 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 60
  • Joined: 26-April 12

Posted 19 July 2012 - 05:33 AM

Hi Asgaroth,

I am having a couple of issues with the extension. One is that none of the styling at all appears. I looked at the source of my page and all the template code is in the source, but it does not appear to do anything. This is my lesser issue.

The main issue is that when I run it, the extension only uploads the last file selected, then outputs to the browser the following:

[{"name":"423e83apt3b-ktchn2.jpg","type":"image\/jpeg","size":125567,"url":"\/1grout\/07192012\/423e83apt3b-ktchn2.jpg","thumbnail_url":"\/1grout\/07192012\/423e83apt3b-ktchn2.jpg","delete_url":"\/moneyshot\/default\/upload\/_method\/delete\/file\/%2Fhome%2Fairmuse%2Fpublic_html%2Fprotected%2F..%2F1grout%2F07192012%2F423e83apt3b-ktchn2.jpg","delete_type":"POST"}]


My view file calls the widget as such:

   <div id='uploadArea'>
	<?php
	$this->widget('xupload.XUpload', array(
			'url' => Yii::app()->createUrl("moneyshot/default/upload"),
			'model' => $model,
			'attribute' => 'file',
			'multiple' => true,
	));
	?>
   </div><!-- uploadArea -->


In my default controller, I put the following:

	public function actions()
	{
		return array(
			'upload'=>array(
				'class'=>'xupload.actions.XUploadAction',
				'path' =>Yii::app() -> getBasePath() . "/../" . user()->id . "grout",
				'publicPath' => Yii::app() -> getBaseUrl() . "/" . user()->id . "grout",
			),
		);
	}


In XUpload.php I set multiple to true.

Thank you.
0

#155 User is offline   VinodC 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 9
  • Joined: 30-April 12

  Posted 19 July 2012 - 05:44 AM

Can we restrict uploaded images according to width and height(640x480) ?
0

#156 User is offline   Asgaroth 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 371
  • Joined: 17-July 09
  • Location:Bogota, Colombia

Posted 19 July 2012 - 01:55 PM

View Postfpolli, on 19 July 2012 - 05:33 AM, said:

Hi Asgaroth,

I am having a couple of issues with the extension...


Hi there, the styling is not an issue, please read through the previos posts to see why. as for the other issue, which browser are you using, and have you tried other browsers? does the the javascript console outputs something?
- Extension: Dynamic DataProvider Behavior
- 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
0

#157 User is offline   Asgaroth 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 371
  • Joined: 17-July 09
  • Location:Bogota, Colombia

Posted 19 July 2012 - 01:56 PM

View PostVinodC, on 19 July 2012 - 05:44 AM, said:

Can we restrict uploaded images according to width and height(640x480) ?


I don't think so, I don't see a way to get those values on the client side. not sure about HTML5 though
- Extension: Dynamic DataProvider Behavior
- 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
0

#158 User is offline   fpolli 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 60
  • Joined: 26-April 12

Posted 19 July 2012 - 04:21 PM

View PostAsgaroth, on 19 July 2012 - 01:55 PM, said:

Hi there, the styling is not an issue, please read through the previos posts to see why. as for the other issue, which browser are you using, and have you tried other browsers? does the the javascript console outputs something?


Hi Asgaroth, thanks for the response. I figured out what was going on. I had used renderpartial to draw the upload form and needed to put processoutput=true. I have basic functionality established, and now just need to iron out all the kinks. Good extension.
0

#159 User is offline   fpolli 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 60
  • Joined: 26-April 12

Posted 20 July 2012 - 05:41 AM

View Postokiem, on 27 April 2012 - 03:09 AM, said:

There seems to be a bug in XUploadAction init() method. When I set subfolderVar to false the subfolder still gets created because the conditional looks like this:
if ($this -> subfolderVar !== null) {
 $this -> _subfolder = Yii::app() -> request -> getQuery($this -> subfolderVar, date("mdY"));
} else if ($this -> subfolderVar !== false) {
 $this -> _subfolder = date("mdY");
}


That means when subfolderVar is set to false, the condition subfolderVar !== null equates to true and a subfolder still gets made

The fix should be:

if ($this -> subfolderVar !== null && $this -> subfolderVar !== false) {
 $this -> _subfolder = Yii::app() -> request -> getQuery($this -> subfolderVar, date("mdY"));
} else if ($this -> subfolderVar !== false) {
 $this -> _subfolder = date("mdY");
}



I noticed this same thing in the logic, but isn't the solution even easier?

if($this->subfolderVar)
....
elseif($this->subfolderVar!==false)
.....

Whether subfolderVar is set to false, null or the empty string, the first condition will be false. Then the second condition will only be false if subfolderVar is specifically set to false.
0

#160 User is offline   ungaro 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 10-July 10

Posted 26 July 2012 - 10:17 AM

Hi,

can we set subfolderVar from the widget code?

i mean like this:
$this->widget('xupload.XUpload', array(
                    'url' => Yii::app()->createUrl("machines/upload"),
                    'model' => $model2,
                    'attribute' => 'file',
                    'multiple' => true,	
					'options'=>array(
					'maxNumberOfFiles' => 1,			
					'maxFileSize'=>3000000,
					'subfolderVar'=>'01012012',

					
)


for me, this doesn't work, it uploads to default dmY subfolder.

i really need to set the subfoldervar from the widget, is there a way to this?
0

Share this topic:


  • (20 Pages)
  • +
  • « First
  • 6
  • 7
  • 8
  • 9
  • 10
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

2 User(s) are reading this topic
0 members, 2 guests, 0 anonymous users