Code Monkey home page Code Monkey logo

xupload's Introduction

xupload's People

Contributors

acorncom avatar alpharder avatar asgaroth avatar gplaza avatar tom-- avatar vbrossier avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xupload's Issues

Option acceptFileTypes causes problem

Hi,

I wanted to use the acceptFileTypes option to validate the file. However, I am getting an error below.

"Uncaught TypeError: Object /(.|/)(gif|jpe?g|png)$/i has no method 'test' "

Does anyone experience this issue or It's just me ?

Bug with upload buttons

Hello
I used your extension. And I have this problem: when I click on a button "add files" in firefox, it works only if I press the button on the left third.
In the IE button only works on double click. Could you tell what has caused this behavior buttons?

xupload Failed to set value of 'subfolderVar'

Hi, I've try to use subfolderVar in my controller like this:

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

and then use widget in my view like this:

$this->widget('xupload.XUpload', array(
                    'url' => Yii::app()->createUrl("suratMasuk/upload", array('parent_id'=>'testparent')),
                    'model' => $xUploadModel,
                    'attribute' => 'file',
                    'multiple' => true, 
));

But, xupload failed to create folder of parent_id value inside upload folder that I've choose.

It works after I change the source code of XUploadAction.php, in line 168 to 172 of init function when xupload try to get subfolderVar, previous ..

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

I change it to ..

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

Regard,

Yf

Session state overwriting

Hi Asgaroth,

First of all thanks a lot for the great extension - it helped me a lot! ;)

I would like to clarify with you one problem that I'm facing while using this extension.
I need users to have opportunity to upload 3 images. And Xupload solves this easily BUT when I submit the form I quite often find only 1 or 2 images actually uploaded to target directory even though 3 was uploaded with Xupload.

After some research I found that this happens because only those 1 or 2 files appear in 'xuploadFiles' session state. Therefore I came to conclusion that this happens because there is no locking of session information (I store my sessions in DB) in this piece of code:

protected function beforeReturn() {
        $path = $this->getPath();

        // Now we need to save our file info to the user's session
        $userFiles = Yii::app( )->user->getState( $this->stateVariable, array());

        $userFiles[$this->formModel->{$this->fileNameAttribute}] = array(
            "path" => $path.$this->formModel->{$this->fileNameAttribute},
            //the same file or a thumb version that you generated
            "thumb" => $path.$this->formModel->{$this->fileNameAttribute},
            "filename" => $this->formModel->{$this->fileNameAttribute},
            'size' => $this->formModel->{$this->sizeAttribute},
            'mime' => $this->formModel->{$this->mimeTypeAttribute},
            'name' => $this->formModel->{$this->displayNameAttribute},
        );
        Yii::app( )->user->setState( $this->stateVariable, $userFiles );

        return true;
    }

Because of this absence of locking 3 quick AJAX upload requests (e.g. with small files to upload) can simply overwrite 'xuploadFiles' state array set by another concurrent request.

This problem seems to be partially related to the following issue that won't be fixed in Yii and needs to be resolved in each certain case:
http://code.google.com/p/yii/issues/detail?id=1403

Can you suggest some kind of general workaround for this problem that can be introduced within the extension?
I think I can do the one for my particular case (MySQL) but I have no idea how this can be done universally.

Thank you a lot for any help in advance!

There is an issue in the delete operation.

When i want to delete a file i uploaded there occur an issue in the "fileupload-ui.js".
I fix it by change the
var that = $(this).data('fileupload');
to
var that = $(this).data('blueimpUI-fileupload');
in the 284 line;
Hope this will help other people use this ext.

Xupload 5.0.1 not working with Yii 1.16.1

Thanks for this great extension. I'm using it properly with Yii framework v 1.15.

I tried the same code with 1.16.1 but it's failing. The widget is displayed properly but the upload does not work. No info in tha app log, no error in the js console. I'm using the basic scenario :

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

public function actionIndex()
{

  Yii::import("xupload.models.XUploadForm");
    $model = new XUploadForm;
    $this -> render('index', array('model' => $model, ));
}

Can't use your repo as a submodule as it currently is

Hello, thanks for your hard work on this tool! I'm planning on adding it in as a submodule on our project so that it's easier to send back pull requests as we work with it / find bugs / add features.

But right now, with the full app involved, it'll get messy (and unnecessary to duplicate all those files). Any chance you could shift to a master branch that has just your code and then have a demo branch which is master plus other files? Or have two repos (xupload and xupload-demo)?

Happy to help by making a pull request if that would help ...

how to load images to Xupload widget ?

hi
i want to load uploaded images to xupload widget to edit by user

for example : user upload images to his product , then he want to edit or delete some of it

how can i load product images to this widget ?

is there any way to do that ?

thanks

Load existing images

Hi!

Thank you much for such a pretty extension. But I have one problem which I cannot solve for 2 days already. Image uploads work well. But how can I show existing images?
I need it very badly on "Product edit" page.
And one more thing. If I load image and refresh page, image disappears, but in the original module it loads automatically if I use out of box scripts.

Hope for your help. Thank you in advance.

subfolderVar issuse

Hello.

I find mistake. as i read in documentation XUploadAction.subfolderVar must support set custom subfolder for upload. Example this hint create session independence code.
public function actions()
{
return array(
'upload'=>array(
'class'=>'xupload.actions.XUploadAction',
'path' => Yii::getPathOfAlias('webroot') . '/data/uploads',
'publicPath' => '/data/uploads',
'subfolderVar' => Yii::app()->session->sessionID,
),
);
}

Now see this code in XUploadAction::init()

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

I not see this code for setup custom folder
this is my fix:

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

i think good fix. take to trunk.

thanks for attentions, have fun! =)

Support multiple file upload widgets on a page

Per the jQuery file upload docs, they suggest adding in a class and not using an ID when there are multiple file upload widgets on a page (different from needing to handle uploading multiple files using one widget).

Should we just figure people will need to specify an ID per widget or can we handle this some other way that would improve ease of use?

how I can get currently uploading file name or size in multiple upload beforeSend

I am upload 2 files fileA.jpg and fileB.jpg in before send I am call a function to check file name already exist in database or not. This is working fine for single file but not working on multiple file upload can any body tell me please how I can get current uploading file name in before send

'beforeSend' => 'js:function(event, files, index, xhr, handler, callBack) {

file_name = files[index].name;

}

subfolderVar is set but default folder is created

Hey there I have downloaded your Project and I like it, but you have a little bug in your XUploadAction when the subfolderVar is set the default folder is created. I have searched for the Problem and found it.
You have programmed this:

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

You have to change it to something like this:

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

Further tweaks and improvements to help with decoupling

I've been working with the code some more this afternoon and have some further suggestions on things that would make this easier to use for lots of people (and allow for overriding your action and form model). Will send up a pull request with some changes so we can discuss them and see what you think.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.