MCPcopy
hub / github.com/nervgh/angular-file-upload / changeFileName

Function changeFileName

examples/issues/873/controllers.js:22–32  ·  view source on GitHub ↗
(fileItem, newFileName)

Source from the content-addressed store, hash-verified

20 };
21
22 function changeFileName(fileItem, newFileName) {
23 newFileName = newFileName || "file" + new Date().getTime();
24
25 var fileName = fileItem.file.name.split('.');
26 if (fileName.length < 2) {
27 alert("Uploaded file must have a valid extension! For more information see the Supported Formats")
28 }
29 var fileExtension = "." + fileName.pop();
30 fileItem.file.name = newFileName + fileExtension;
31 return fileItem;
32 }
33 }]);

Callers 1

controllers.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected