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

Jump to content

  • (20 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

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

#1 User is offline   R.K. 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 20-September 10

Posted 09 May 2011 - 07:37 AM

I found that this extensions is out of date. Maybe some one can update it?
0

#2 User is offline   Asgaroth 

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

Posted 09 May 2011 - 10:44 AM

The extension is now up to date, any feedback is appreciated thanks.

The link:

http://www.yiiframew...ension/xupload/
- 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

#3 User is offline   xav 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 09-August 10

Posted 10 May 2011 - 04:49 AM

Hello,

Nice extension, and working great as is. I even used the EXUploadAction file.

However, I would like to integrate this extension in a wider project, and use it as the upload solution for profile photos. The thing is that i need to change the filename (when upload completed) according to a additional data from the form. With the onComplete callback i should update the profile photo.

Since now, i managed to change the filename in the EXUploadAction file (i don't want to temper with the extension code) using a dummy name, but the callback always gives me the original filename.

How can I send an additional data with the form ? How to rename the file so the onComplete callBack returns the modified name ?

Here is the onComplete callback

'options' => array('onComplete' => 'js:function (event, files, index, xhr, handler, callBack) {
        $("#photo").html(\'<img src="../../images/profiles/\'+files[index].name + \'"/>\' );
                        }'
),


Best Regards,

xavier
0

#4 User is offline   Asgaroth 

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

Posted 10 May 2011 - 08:39 PM

The files[index].name refers to the current html file field objects, because the name changed in the server and not on the client side this variable is not updated.

What you should use instead is handler.response which holds the JSON response from the server, this JSON is constructed in the action, for XUploadAction:

line 30. echo json_encode(array("name" => $model->name,"type" => $model->mime_type,"size"=> $model->getReadableFileSize()));


There you can add/remove/change any information you want to send back to the client here.

In your specific case, if you changed $model->name before that line, then the JSON already holds the correct name. so your code should look like:

'options' => array('onComplete' => 'js:function (event, files, index, xhr, handler, callBack) {
        $("#photo").html(\'<img src="../../images/profiles/\'+handler.response.name + \'"/>\' );
                        }'
),



Thumbs up, follow if you like this extension, any feedback apreciated
- 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

#5 User is offline   xav 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 09-August 10

Posted 11 May 2011 - 02:43 AM

View PostAsgaroth, on 10 May 2011 - 08:39 PM, said:



'options' => array('onComplete' => 'js:function (event, files, index, xhr, handler, callBack) {
        $("#photo").html(\'<img src="../../images/profiles/\'+handler.response.name + \'"/>\' );
                        }'
),






Hi,
It's working like a charm !!! Many thanks !!!

Is ti possible to pass additional parameters from the form ?
0

#6 User is offline   R.K. 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 117
  • Joined: 20-September 10

Posted 11 May 2011 - 03:40 AM

View Postxav, on 11 May 2011 - 02:43 AM, said:

Hi,
It's working like a charm !!! Many thanks !!!

Is ti possible to pass additional parameters from the form ?


check new version of http://aquantum-demo...com/file-upload there you can have thumbs directly from your local disk drive, and after upload you also can have resized image.
0

#7 User is offline   xav 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 09-August 10

Posted 11 May 2011 - 03:53 AM

By the way, for those interested in.... my onComplete callback should refresh the image in the div when new file is uploaded. Since the file is renamed with the same name, the image never changes (because of the cache surely).

Well, here goes the work around, just add a time stamp as a parameter for the image file url. This will force a GET.


'options' => array(					
	'onComplete' => 'js:function (event, files, index, xhr, handler, callBack) {
	d = new Date();
        $("#photo").hide().html(\'<img src="../../images/profiles/\'+handler.response.name +\'?\'+ d.getTime() +\'"/>\' ).fadeIn(\'fast\');
                        }'
),



Cheers
0

#8 User is offline   xav 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 50
  • Joined: 09-August 10

Posted 11 May 2011 - 03:59 AM

View PostR.K., on 11 May 2011 - 03:40 AM, said:

check new version of http://aquantum-demo...com/file-upload there you can have thumbs directly from your local disk drive, and after upload you also can have resized image.



Waow, if there is a thumbelize, resize and crop option this is going to be a killer extension !!!
0

#9 User is offline   Asgaroth 

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

Posted 11 May 2011 - 02:48 PM

View PostR.K., on 11 May 2011 - 03:40 AM, said:

check new version of http://aquantum-demo...com/file-upload there you can have thumbs directly from your local disk drive, and after upload you also can have resized image.


I cant find where they mention the resize image thing.
- 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

#10 User is offline   Asgaroth 

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

Posted 11 May 2011 - 02:54 PM

View Postxav, on 11 May 2011 - 02:43 AM, said:

Hi,
It's working like a charm !!! Many thanks !!!

Is ti possible to pass additional parameters from the form ?



Check the wiki, there are several tutorials:

https://github.com/b...ional-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

#11 User is offline   Mariaczi+PL 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 30
  • Joined: 05-March 11

Posted 22 May 2011 - 12:30 PM

Can you post simple example how to use it with Yii?
It looks and works great, but I dont know how to start with this...

Just simple controller code and simple view. Please :)
Can you do this?

How to configure upload path by the controller? (I need pass path so safety for every user)
0

#12 User is offline   Asgaroth 

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

Posted 23 May 2011 - 09:33 AM

View PostMariaczi+PL, on 22 May 2011 - 12:30 PM, said:

Can you post simple example how to use it with Yii?
It looks and works great, but I dont know how to start with this...

Just simple controller code and simple view. Please :)
Can you do this?

How to configure upload path by the controller? (I need pass path so safety for every user)


There is an entire Yii project (demo) in the downloads, what is it you are missing?
- 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

#13 User is offline   Mariaczi+PL 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 30
  • Joined: 05-March 11

Posted 23 May 2011 - 09:36 AM

sorry, I didn't see it!
0

#14 User is offline   migajek 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 81
  • Joined: 15-November 09

Posted 29 May 2011 - 02:06 PM

Hi,
How can I call JS code when the queue is empty?
0

#15 User is offline   NewToYii 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 39
  • Joined: 20-July 10

Posted 05 June 2011 - 03:23 PM

Hi,

great extension, but it would be even better to have some more documentation on this.

For example, i'd like to know how to get functions on the example-site on example-site at appspot, like alert "File to small!", etc.

Please extend the demo in the extension-zip.

Thx
0

#16 User is offline   Asgaroth 

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

Posted 07 June 2011 - 07:47 AM

View Postmigajek, on 29 May 2011 - 02:06 PM, said:

Hi,
How can I call JS code when the queue is empty?



View PostNewToYii, on 05 June 2011 - 03:23 PM, said:

Hi,

great extension, but it would be even better to have some more documentation on this.

For example, i'd like to know how to get functions on the example-site on example-site at appspot, like alert "File to small!", etc.

Please extend the demo in the extension-zip.

Thx


The documentation in the yii site its about the installation and basic usage, the documentation your guys are asking for, its the jquery documentation.

The answers to all this questions are in the wiki, please take a look there.
- 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

#17 User is offline   quarkmarino 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 11-August 10

Posted 01 July 2011 - 04:27 AM

Hi, anybody know how to implement multiple instances of the widget in a single page, I've created 2 juidialog and loaded a widget on each one from diferent views, but when a add I file to the second xupload widget it is queued to the first one, so how do I add files to each one separately, thank you
0

#18 User is offline   Asgaroth 

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

Posted 06 July 2011 - 10:45 AM

The jquery plugin has been updated to a new version, however the new documentation lacks many examples for common task, the old wiki has been restored and the examples are now back for the old version, please vote here to update or not the extension. take into account the lack of documentation for the new version.
- 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

#19 User is offline   Asgaroth 

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

Posted 06 July 2011 - 11:43 AM

View Postquarkmarino, on 01 July 2011 - 04:27 AM, said:

Hi, anybody know how to implement multiple instances of the widget in a single page, I've created 2 juidialog and loaded a widget on each one from diferent views, but when a add I file to the second xupload widget it is queued to the first one, so how do I add files to each one separately, thank you



The wiki for the original jquery plugin has been restored

https://github.com/b...ile-Upload/wiki

You can find the answer to your specific need [here](https://github.com/b...lds-in-one-Form "multiple input fields")
- 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

#20 User is offline   Sergison 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 04-August 11

Posted 04 August 2011 - 12:24 PM

Hi.
I'm have a problem whis that extension. I can't define callback js function.

$this-&gt;widget('ext.xupload.XUploadWidget', array(
					'url' =&gt; Yii::app()-&gt;createUrl(&quot;admin/images/upload&quot;, array(&quot;type&quot; =&gt; $this-&gt;getId(), &quot;item_id&quot; =&gt; $model-&gt;m_id)),
                    'model' =&gt; new Images,
                    'attribute' =&gt; 'images',
					'multiple' =&gt; true,
                    'htmlOptions'=&gt;array('name' =&gt; 'images'),
                    'options' =&gt; array
                        'onComplete' =&gt; 'js:function (event, files, index, xhr, handler, callBack) {
                            console.log(&quot;upload finish&quot;);
                        }',
                    ),
));

I have that error
Uncaught TypeError: Cannot read property 'name' of null     query.fileupload-ui.js:97

Snippet of this file here
this.removeNode = function (node, callBack) {
            if (node) {
                node.fadeOut(function () {
                    $(this).remove();
                    if (typeof callBack === func) {
                        try {
                            callBack();
                        } catch (e) {
                            // Fix endless exception loop:
                            $(this).stop();
                            throw e;
/*jquery.fileupload-ui.js:97Uncaught TypeError: Cannot read property 'name' of null*/
                        }
                    }
                });
            } else if (typeof callBack === func) {
                callBack();
            }
        };

Please help!
0

Share this topic:


  • (20 Pages)
  • +
  • 1
  • 2
  • 3
  • Last »
  • You cannot start a new topic
  • You cannot reply to this topic

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