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

Jump to content

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

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

#121 User is offline   nightmove 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 11-March 12
  • Location:Germany

Posted 01 June 2012 - 09:26 AM

View PostAsgaroth, on 01 June 2012 - 09:12 AM, said:

Its the firebug console showing anything? looks like a javascript error.


Unfortunately, firebug doesn't show anything. Just nothing happens. Even the "Save" button at the end of my view doesn't work. If I comment out the widget, everything works, but with the widged, nothing :(

First i thought its maybe because of form-inside-form. But the widget doesn't print any form, only an input, right?

I have no clue, what to do!
0

#122 User is offline   florin p 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 36
  • Joined: 25-September 11

Posted 01 June 2012 - 09:57 AM

View Postmanuelpm, on 16 May 2012 - 12:57 PM, said:

Asgaroth:

Thank you so much for your help, it is working now, now I have a problem with fileTypes, I have this code:

$uploadm = new XUploadForm;
$this->widget('xupload.XUpload', array(
                    'url' => Yii::app()->createUrl("site/uploadP"),
                    'model' => $uploadm,
                    'attribute' => 'file',
                    'multiple' => false,
					'options'=>array(
						'completed'=>'js:function(){location.reload(true);}',
						//'sent'=>'js:function(){location.reload(true);}',
						'maxNumberOfFiles'=>1,
						'maxFileSize'=>3000000,
						'acceptFileTypes'=>'/(\.|\/)(jpg|png)$/i'
					)
					

));

it throws 'this.options.acceptFileTypes.test is not a function', now i read in git that is because i cant use the '' but if i dont use them php throws unexpected /, any ideas anyone?
Thanks so much


Hi manuelpm,

I have same problems as you, did you find any solution?
Thanks
0

#123 User is offline   Asgaroth 

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

Posted 01 June 2012 - 03:48 PM

View Postnightmove, on 01 June 2012 - 09:26 AM, said:

Unfortunately, firebug doesn't show anything. Just nothing happens. Even the "Save" button at the end of my view doesn't work. If I comment out the widget, everything works, but with the widged, nothing :(

First i thought its maybe because of form-inside-form. But the widget doesn't print any form, only an input, right?

I have no clue, what to do!


The widget does indeed render a form, here is a wiki about sending additional form data.
- 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

#124 User is offline   nightmove 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 11-March 12
  • Location:Germany

Posted 01 June 2012 - 05:19 PM

View PostAsgaroth, on 01 June 2012 - 03:48 PM, said:

The widget does indeed render a form, here is a wiki about sending additional form data.


Thanks Asgaroth but I am having no clue how to achieve a working widget, even with the wiki. My view consist of a big form with different data. In between I'd like to have this upload to add up to 4 images. Any hints how I can set up the widget to work inside my form?
0

#125 User is offline   florin p 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 36
  • Joined: 25-September 11

Posted 02 June 2012 - 09:50 AM

Hi

I'm trying to use this extention for my gallery but the option "acceptFileTypes" doesn't work, can you kindly advice how to limit file types to use only jpg and png? I read the wiki but i get same errors in firebug "this.options.acceptFileTypes.test"

Thanks
0

#126 User is offline   Asgaroth 

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

Posted 02 June 2012 - 12:38 PM

View Postnightmove, on 01 June 2012 - 05:19 PM, said:

Thanks Asgaroth but I am having no clue how to achieve a working widget, even with the wiki. My view consist of a big form with different data. In between I'd like to have this upload to add up to 4 images. Any hints how I can set up the widget to work inside my form?


This widgets is for asynchronous file upload, meaning you can start to upload some files while adding other files for example, It looks like your use case is abour syncrhonous file upload with some other data.

If thats correct, you only need to add 4 <input type="file"> to your normal form, if all you want its a pretty file field you can take a look at http://filamentgroup...ve_enhancement/
- 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

#127 User is offline   Asgaroth 

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

Posted 02 June 2012 - 12:40 PM

View Postflorin p, on 02 June 2012 - 09:50 AM, said:

Hi

I'm trying to use this extention for my gallery but the option "acceptFileTypes" doesn't work, can you kindly advice how to limit file types to use only jpg and png? I read the wiki but i get same errors in firebug "this.options.acceptFileTypes.test"

Thanks


Can you show us some code?

normaly your regex should like like this:

'acceptFileTypes' => "'/(\.|\/)(jpe?g|png)$/i'",

- 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

#128 User is offline   florin p 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 36
  • Joined: 25-September 11

Posted 02 June 2012 - 02:00 PM

View PostAsgaroth, on 02 June 2012 - 12:40 PM, said:

Can you show us some code?

normaly your regex should like like this:

'acceptFileTypes' => "'/(\.|\/)(jpe?g|png)$/i'",



Hi,

Thanks for your quick response, here is my code:

View:
<?php

$uploadm = new XUploadForm;

$this->widget('xupload.XUpload', array(
    'url' => Yii::app()->createUrl("images/upload"),
    'model' => $uploadm,
    'attribute' => 'file',
    'multiple' => true,
    'options' => array(
        'maxFileSize' => 3000000,
        'acceptFileTypes' => "'/(\.|\/)(jpe?g|png)$/i'",
    )
));
?>


The source:

<script type="text/javascript">
/*<![CDATA[*/
jQuery(function($) {
jQuery('#XUploadForm-form').fileupload({'maxFileSize':3000000,'acceptFileTypes':'\'/(\\.|\\/)(jpe?g|png)$/i\''});
});
/*]]>*/
</script>


I tried with this regex but doesn't work, in the console I get this error: this.options.acceptFileTypes.test is not a function.
0

#129 User is offline   Asgaroth 

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

Posted 02 June 2012 - 02:15 PM

This works for me, you can see any type of file in the browse window, but when you select the files the widget warns you and allows you to upload only valid file types

<?php

$uploadm = new XUploadForm;

$this->widget('xupload.XUpload', array(
            'url' => Yii::app()->createUrl("images/upload"),
            'model' => $uploadm,
            'attribute' => 'file',
            'multiple' => true,
            'options' => array(
                'maxFileSize' => 3000000,
                'acceptFileTypes' => "js:/(\.|\/)(jpe?g|png)$/i",
            )
        ));
?>

- 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
2

#130 User is offline   florin p 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 36
  • Joined: 25-September 11

Posted 02 June 2012 - 02:27 PM

View PostAsgaroth, on 02 June 2012 - 02:15 PM, said:

This works for me, you can see any type of file in the browse window, but when you select the files the widget warns you and allows you to upload only valid file types

<?php

$uploadm = new XUploadForm;

$this->widget('xupload.XUpload', array(
            'url' => Yii::app()->createUrl("images/upload"),
            'model' => $uploadm,
            'attribute' => 'file',
            'multiple' => true,
            'options' => array(
                'maxFileSize' => 3000000,
                'acceptFileTypes' => "js:/(\.|\/)(jpe?g|png)$/i",
            )
        ));
?>




Hi,

Yes it works, thanks a lot!
0

#131 User is offline   meo 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 19-March 12

Posted 04 June 2012 - 06:23 AM

Hi! Is there someone that used the option "formData" to add more data taken from the page?

Thanks,
fabio
0

#132 User is offline   florin p 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 36
  • Joined: 25-September 11

Posted 07 June 2012 - 11:43 AM

Hi Asgaroth,

I'm back with one question:
How could I change the name of files before are saved?

Currently i have something like this:

$model->name = "{$prefix}-{$randomNum}.{$model->extension}";


But how can I have?

$model->name = "{$image->id}-{$randomNum}.{$model->extension}";


It is possible to achieve this in xupload action?

Thanks, Flo
0

#133 User is offline   Asgaroth 

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

Posted 07 June 2012 - 12:56 PM

View Postflorin p, on 07 June 2012 - 11:43 AM, said:

Hi Asgaroth,

I'm back with one question:
How could I change the name of files before are saved?

Currently i have something like this:

$model->name = "{$prefix}-{$randomNum}.{$model->extension}";


But how can I have?

$model->name = "{$image->id}-{$randomNum}.{$model->extension}";


It is possible to achieve this in xupload action?

Thanks, Flo


XUploadAction its just an example of handling simple file uploads, you should normaly, either modify the XUploadACtion (not recommended) or create your own Upload Action to handle all your requirements.
- 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

#134 User is offline   nightmove 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 48
  • Joined: 11-March 12
  • Location:Germany

Posted 09 June 2012 - 10:14 AM

Hello,

I am having a problem with the event that is triggered after each uploaded successfully completed. I tried events like 'onComplete' and 'fileuploadcomplete' but nothing triggers my alert box. Do I have to uncommment the events in jquery.fileupload.js?

$this->widget('xupload.XUpload', array(
  'url' => Yii::app()->createUrl('offer/upload', array(
   			'offer_id' => $offerId,
  )),
  'model' => $model,
  'name' => 'image',
  'attribute' => 'file',
  'multiple' => true,
  'options' => array(
            	'completed' => 'function(event, files, index, xhr, handler, callBack) {alert(files);}',
  ),
));


thanks in advance
0

#135 User is offline   NeoXidizer 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 2
  • Joined: 10-June 12

Posted 10 June 2012 - 04:09 AM

Hello.
1. Why in the description of the topic says "out of date"? We should not use this extension?
2. How to use variable 'uploadTemplate'? How to copy original views(upload, form, download) and edit them outside of extension folder?
Thanks
0

#136 User is offline   Asgaroth 

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

Posted 10 June 2012 - 12:55 PM

View Postnightmove, on 09 June 2012 - 10:14 AM, said:

Hello,

I am having a problem with the event that is triggered after each uploaded successfully completed. I tried events like 'onComplete' and 'fileuploadcomplete' but nothing triggers my alert box. Do I have to uncommment the events in jquery.fileupload.js?

$this->widget('xupload.XUpload', array(
  'url' => Yii::app()->createUrl('offer/upload', array(
   			'offer_id' => $offerId,
  )),
  'model' => $model,
  'name' => 'image',
  'attribute' => 'file',
  'multiple' => true,
  'options' => array(
            	'completed' => 'function(event, files, index, xhr, handler, callBack) {alert(files);}',
  ),
));


thanks in advance


Check this post
- 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

#137 User is offline   Asgaroth 

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

Posted 10 June 2012 - 01:03 PM

View PostNeoXidizer, on 10 June 2012 - 04:09 AM, said:

Hello.
1. Why in the description of the topic says "out of date"? We should not use this extension?
2. How to use variable 'uploadTemplate'? How to copy original views(upload, form, download) and edit them outside of extension folder?
Thanks


1. It was an old post, don't pay attention, the extension is up to date.
2. Just copy them to your model views folder, edit them, render them with renderPartial, or include the code inside your normal views. and call the widget like:

<?php
$this->widget('xupload.XUpload', array(
                    'url' => Yii::app()->createUrl("site/upload"),
                    'model' => $model,
                    'attribute' => 'file',
                    'multiple' => true,
                    'uploadTemplate' => '#template-upload' //The upload template id
));
?>


same applies for the download template
- 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

#138 User is offline   Wiseon3 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 13
  • Joined: 14-February 11

Posted 11 June 2012 - 08:04 AM

View PostDyego Nery, on 05 May 2012 - 09:16 PM, said:

Just a doubt.
The extension don't have the preview funcionallity?

The upload is working fine. But the previews don't show up when each image is completed.

Hugs

I'm surprised no one said anything about this. I've noticed the same thing. For the image preview to work you need to add the following:
            Yii::app() -> clientScript -> registerScriptFile("http://blueimp.github.com/JavaScript-Load-Image/load-image.min.js", CClientScript::POS_END);
            Yii::app() -> clientScript -> registerScriptFile("http://blueimp.github.com/JavaScript-Canvas-to-Blob/canvas-to-blob.min.js", CClientScript::POS_END);

in publishAssets() in the XUpload.php file, after
Yii::app() -> clientScript -> registerScriptFile("http://blueimp.github.com/JavaScript-Templates/tmpl.min.js", CClientScript::POS_END);

1

#139 User is offline   Ivo Renkema 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 28
  • Joined: 20-April 12

Posted 13 June 2012 - 04:03 AM

Thanks Asgaroth,

This is an excellent extension. You helped me a bunch!
0

#140 User is offline   ronyaja 

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

Posted 18 June 2012 - 08:14 AM

Hello,

I have some problems when trying to submit additional data and then save it into database. I have tried the wiki many times but i still can't understand how to implement it. Here the simple case, i want to save some of image's information such as title, caption, and description. Can anyone give me some example about it with ajax or without ajax ?
0

Share this topic:


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

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