Skip to content
This repository has been archived by the owner on Aug 22, 2022. It is now read-only.

关于拖拽上传 文件判断过于严格的一个问题修复 #116

Closed
kalcaddle opened this issue Feb 27, 2014 · 3 comments
Closed

关于拖拽上传 文件判断过于严格的一个问题修复 #116

kalcaddle opened this issue Feb 27, 2014 · 3 comments

Comments

@kalcaddle
Copy link

由于有的文件type为空:比如 .zip .url 或者没有扩展名的也是文件。
我做了入下调整:

        canAccessFolder = !!(items && items[ 0 ].webkitGetAsEntry);
            for ( i = 0, len = files.length; i < len; i++ ) {
                file = files[i];
                // change by warlee 
                // if ( file.type ) {
                //     results.push( file );
                // } else if ( !file.type && canAccessFolder ) {
                //     promises.push( this._traverseDirectoryTree(
                //             items[ i ].webkitGetAsEntry(), results ) );
                // }

                if (items[i].webkitGetAsEntry()!=null && items[i].webkitGetAsEntry().isDirectory) {//if folder
                    if(canAccessFolder){
                        promises.push( this._traverseDirectoryTree(
                            items[ i ].webkitGetAsEntry(), results ) );
                    }
                }else{//is file
                    results.push(file);
                }
            }   



         _traverseDirectoryTree: function( entry, results ) {
            var deferred = Base.Deferred(),
                me = this;   
            if (entry.isFile ) {
                entry.file(function( file ) {
                    //== change by warlee 
                    //file.type && results.push( file );
                    results.push( file );
                    deferred.resolve( true );
                });
            } 
@kalcaddle
Copy link
Author

windows 下 chrome 30

mac下不知道有没有类似问题。

@2betop
Copy link
Contributor

2betop commented Feb 27, 2014

根据file.type来判断是否为文件看来是不正确的,我去修改一下这块逻辑,多谢反馈

@2betop
Copy link
Contributor

2betop commented Apr 2, 2014

已修复,谢谢反馈!
https://github.com/fex-team/webuploader/releases/tag/v0.1.1

@2betop 2betop closed this as completed Apr 2, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants