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

Jump to content

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

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

#41 User is offline   John J 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 11
  • Joined: 05-July 11
  • Location:Golden Grove, South Australia

Posted 24 August 2011 - 12:39 AM

Thanks for your help Asgaroth. That worked a treat.

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.
0

#42 User is offline   talles 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 39
  • Joined: 08-May 11

Posted 11 September 2011 - 02:03 PM

very good extension , i can upload my images now , but How can i insert in the database the images attributes?

like:

Imagem = new Imagem;

imagem = post;
imagem.save();




in witch contronller i put it ?
0

#43 User is offline   zanforlin 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 20
  • Joined: 06-September 11

Posted 23 September 2011 - 02:03 PM

Hello.

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
0

#44 User is offline   kareem zok 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 12
  • Joined: 18-January 10
  • Location:lebanon

Posted 02 October 2011 - 03:17 PM

hey guys im trying this widget and i m having problem getting the name of image in my controller

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
Kareem zock
Software engineer

T: +(961) 03 497265
E: kareemzok@gmail.com
Skype: kareem_zok

Posted Image Linkedin

Posted Image Facebook

Posted Image Twitter

About me.com
0

#45 User is offline   JayC 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 31-March 11

Posted 03 October 2011 - 09:23 AM

Hi,

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?
0

#46 User is offline   Shah 

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

Posted 11 October 2011 - 06:56 AM

Hello,

Is this extension updated?
The demo and the extension looks different when i implemented it
0

#47 User is offline   Asgaroth 

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

Posted 11 October 2011 - 07:57 AM

View PostShah, on 11 October 2011 - 06:56 AM, said:

Hello,

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

#48 User is offline   Bymannan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 04-November 11

Posted 05 November 2011 - 04:45 PM

Hi all,

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)


0

#49 User is offline   Asgaroth 

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

Posted 05 November 2011 - 09:10 PM

View PostBymannan, on 05 November 2011 - 04:45 PM, said:

Hi all,

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

#50 User is offline   Dinesh 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 12-November 11

Posted 12 November 2011 - 08:56 AM

Hi,
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
0

#51 User is offline   Scott Deagan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 04-February 10

Posted 23 November 2011 - 07:35 AM

Hi Asgaroth,

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.
0

#52 User is offline   Scott Deagan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 04-February 10

Posted 23 November 2011 - 08:03 AM

I solved my problem thanks to Jesse (post #37). I hadn't instantiated XUploadForm in my action handler:

  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.
0

#53 User is offline   Asgaroth 

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

Posted 23 November 2011 - 11:37 AM

View PostScott Deagan, on 23 November 2011 - 08:03 AM, said:

Still leaves my other question: how to theme XUploadWidget like the online demo (http://blueimp.githu...ry-File-Upload/)?

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

#54 User is offline   Scott Deagan 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 04-February 10

Posted 30 November 2011 - 07:41 AM

What about auto-populating the Widget with the contents of a directory? Is that possible? For example, point the parent directory to something like images/uploads/01 and have the widget automatically populate itself with all files in images/uploads/01?
0

#55 User is offline   Asgaroth 

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

Posted 30 November 2011 - 09:25 AM

View PostScott Deagan, on 30 November 2011 - 07:41 AM, said:

What about auto-populating the Widget with the contents of a directory? Is that possible? For example, point the parent directory to something like images/uploads/01 and have the widget automatically populate itself with all files in images/uploads/01?


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

#56 User is offline   mikewalen 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 41
  • Joined: 27-August 11
  • Location:Hamilton, New Zealand

Posted 24 January 2012 - 06:08 PM

Firstly, great extension Asgaroth.

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 :)
0

#57 User is offline   xav 

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

Posted 30 January 2012 - 11:36 AM

For those interested I slightly modified the model (i needed to)

$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];

0

#58 User is offline   xav 

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

Posted 31 January 2012 - 10:14 AM

View Postmikewalen, on 24 January 2012 - 06:08 PM, said:

Firstly, great extension Asgaroth.

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 !
0

#59 User is offline   xav 

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

Posted 31 January 2012 - 10:20 AM

View PostDinesh, on 12 November 2011 - 08:56 AM, said:

Hi,
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).
0

#60 User is offline   xav 

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

Posted 31 January 2012 - 10:27 AM

Adding the trim file to the xupload action

//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() );

0

Share this topic:


  • (19 Pages)
  • +
  • 1
  • 2
  • 3
  • 4
  • 5
  • 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