11/*
2- angular-file-upload v1.0.2
2+ angular-file-upload v1.0.3
33 https://github.com/nervgh/angular-file-upload
44*/
55( function ( angular , factory ) {
@@ -720,23 +720,44 @@ module
720720
721721 /**
722722 * Creates an instance of FileLikeObject
723- * @param {String } fakePath
723+ * @param {String|Object } fakePathOrObject
724724 * @constructor
725725 */
726- function FileLikeObject ( fakePath ) {
727- var path = fakePath ;
726+ function FileLikeObject ( fakePathOrObject ) {
727+ var postfix = angular . isString ( fakePathOrObject ) ? 'FakePath' : 'Object' ;
728+ var method = '_createFrom' + postfix ;
729+ this [ method ] ( fakePathOrObject ) ;
730+ }
731+
732+ /**
733+ * Creates file from fake path string
734+ * @param {String } path
735+ * @private
736+ */
737+ FileLikeObject . prototype . _createFromFakePath = function ( path ) {
728738 this . lastModifiedDate = null ;
729739 this . size = null ;
730740 this . type = 'like/' + path . slice ( path . lastIndexOf ( '.' ) + 1 ) . toLowerCase ( ) ;
731741 this . name = path . slice ( path . lastIndexOf ( '/' ) + path . lastIndexOf ( '\\' ) + 2 ) ;
732- }
742+ } ;
743+ /**
744+ * Creates file from object
745+ * @param {File|FileLikeObject } object
746+ * @private
747+ */
748+ FileLikeObject . prototype . _createFromObject = function ( object ) {
749+ this . lastModifiedDate = angular . copy ( object . lastModifiedDate ) ;
750+ this . size = object . size ;
751+ this . type = object . type ;
752+ this . name = object . name ;
753+ } ;
733754
734755 // ---------------------------
735756
736757 /**
737758 * Creates an instance of FileItem
738759 * @param {FileUploader } uploader
739- * @param {File|FileLikeObject|HTMLInputElement } file
760+ * @param {File|FileLikeObject } file
740761 * @param {File|Object } options
741762 * @param {HTMLInputElement } [input]
742763 * @constructor
@@ -754,7 +775,7 @@ module
754775 method : uploader . method
755776 } , options , {
756777 uploader : uploader ,
757- file : angular . copy ( file ) ,
778+ file : new FileUploader . FileLikeObject ( file ) ,
758779 isReady : false ,
759780 isUploading : false ,
760781 isUploaded : false ,
0 commit comments