Created
February 13, 2016 10:36
-
-
Save rankun203/a378c6a5cf11112f31af to your computer and use it in GitHub Desktop.
function genFileKey()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 根据文件名生成文件的 key | |
* @param fileName | |
* @returns {string} | |
*/ | |
function genFileKey(fileName) { | |
var fileKey = ''; | |
// 将文件名中的有效字符提取出来作为文件 key | |
var realFileName = fileName.match(/[\w|\.]/g).join(''); | |
if (realFileName.startsWith('.')) realFileName = '_' + realFileName; | |
if (thisUser) fileKey += thisUser.id + '/'; | |
fileKey += Functions.guid() + '/' + realFileName; | |
return fileKey; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment