Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 8430

Re: How to handle special characters in file names of sap.ui.unified.FileUploader

$
0
0

Hi Thomas,

 

I always check the filename in the front end.

 

e.g.

 

uploadFile : function() {                        var file = jQuery.sap.domById("fileUploader-fu").files[0];                        var regex = new RegExp(/[^A-Za-z0-9\-\_\.\s]/);                        var check = regex.test(file.name);                        if (check == true) {                            var filenameDialog = new sap.m.Dialog(                                    {                                        title : "Warning",                                        content : [ new sap.m.Text(                                                {                                                    text : "bla bla... Please rename file..."                                                }) ],                                        beginButton : new sap.m.Button({                                            text : "ok",                                            width : '50%',                                            press : function() {                                                filenameDialog.close();                                            }                                        })                                    }).open();                        } else {                            var oHeaders = {                                "slug" : file.name                            };                            sap.ui.getCore().getModel().setHeaders(oHeaders);                            sap.ui.getCore().getModel().refreshSecurityToken(                                    function() {                                        sap.ui.getCore().getModel().create(                                                "/FileSet", file, function() {                                                }, function() {                                                    return true;                                                });                                    });                        }                    },

Viewing all articles
Browse latest Browse all 8430

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>