sprd/view/ImageUploadClass.js
function (file, callback) {

                var self = this,
                    reader = new FileReader();

                var uploadDesign = this.$.imageUploadService.upload(file, function (err) {
                    if (!err) {
                        self.trigger("uploadComplete", {
                            uploadDesign: uploadDesign
                        });
                    } else {
                        self.trigger("uploadError", {
                            error: err,
                            uploadDesign: uploadDesign
                        });
                    }

                    callback && callback(err, uploadDesign);
                });

                reader.onload = function(evt) {

                    var img = new Image();
                    img.onload = function() {
                        uploadDesign.set({
                            previewImage: evt.target.result,
                            localImage: evt.target.result
                        });
                    };
                    img.src = evt.target.result;
                };

                reader.readAsDataURL(file);


                return uploadDesign;
            }
function (file, callback) {

                var self = this,
                    reader = new FileReader();

                var uploadDesign = this.$.imageUploadService.upload(file, function (err) {
                    if (!err) {
                        self.trigger("uploadComplete", {
                            uploadDesign: uploadDesign
                        });
                    } else {
                        self.trigger("uploadError", {
                            error: err,
                            uploadDesign: uploadDesign
                        });
                    }

                    callback && callback(err, uploadDesign);
                });

                reader.onload = function(evt) {

                    var img = new Image();
                    img.onload = function() {
                        uploadDesign.set({
                            previewImage: evt.target.result,
                            localImage: evt.target.result
                        });
                    };
                    img.src = evt.target.result;
                };

                reader.readAsDataURL(file);


                return uploadDesign;
            }
function ( file , callback ) { var self = this , reader = new FileReader ( ) ; var uploadDesign = this . $ . imageUploadService . upload ( file , function ( err ) { if ( ! err ) { self . trigger ( "uploadComplete" , { uploadDesign : uploadDesign } ) ; } else { self . trigger ( "uploadError" , { error : err , uploadDesign : uploadDesign } ) ; } callback && callback ( err , uploadDesign ) ; } ) ; reader . onload = function ( evt ) { var img = new Image ( ) ; img . onload = function ( ) { uploadDesign . set ( { previewImage : evt . target . result , localImage : evt . target . result } ) ; } ; img . src = evt . target . result ; } ; reader . readAsDataURL ( file ) ; return uploadDesign ; }
Upload image to Spreadshirt platform.

@param {File} file
@param {Function} [callback]
@returns {sprd.type.UploadDesign}
Upload image to Spreadshirt platform .