Skip to content

Commit

Permalink
upload: Change clipboard paste file upload name
Browse files Browse the repository at this point in the history
- It seems that browser's clipboard paste file object is sealed, in
recently.
- So, change default naming method and name
  • Loading branch information
doortts committed Jul 17, 2017
1 parent 65ede6c commit 044bba0
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 41 deletions.
8 changes: 6 additions & 2 deletions public/javascripts/common/yobi.Files.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,8 @@ yobi.Files = (function(){
}

var oData = new FormData();
oData.append("filePath", oFile, oFile.name);
var filename = oFile.name === 'image.png' ? nSubmitId + ".png" : oFile.name;
oData.append("filePath", oFile, filename);

$.ajax({
"type" : "post",
Expand Down Expand Up @@ -568,7 +569,10 @@ yobi.Files = (function(){
* @return {Number}
*/
function _getSubmitId(){
return parseInt(Math.random() * new Date().getTime());
var now = new Date();
return now.getFullYear() + '' + now.getMonth() + '' + now.getDate()
+ '-' + now.getHours() + '' + now.getMinutes() + '' + now.getSeconds()
+ '-' + now.getMilliseconds();
}

/**
Expand Down
Loading

0 comments on commit 044bba0

Please sign in to comment.