Product Bundles
DevCraft
All Telerik .NET and Kendo UI JavaScript components and AI Tools in one package.
Kendo UI
Bundle of AI Tools plus four JavaScript UI libraries built natively for jQuery, Angular, React and Vue.
Build JavaScript UI
Javascript
Telerik
Build modern .NET business apps
.Net Web
Cross-Platform
Desktop
Reporting and Documents
AI for Developers & IT
Ensure AI program success
AI Coding
AI Engineering
Additional Tools
Enhance the developer and designer experience
Testing & Mocking
Debugging
UI/UX Tools
CMS
Free Tools
Support and Learning
Productivity and Design Tools
I have set the TargetFolder e.g.
TargetFolder="~/content"
and it works fine except that i want the file names to be kind od hashed e.g. myfile.jpg to be saved as 8unfsKjfjskskdjf^7i.jpg
I have the HashFileName(string file) function but not quite sure where to apply it.
Thank you
protected
void
Unnamed_FileUploaded(
object
sender, Telerik.Web.UI.FileUploadedEventArgs e)
{
// Get the file object
var file = e.File;
// Get file name and extension as string array
var fileNameAndExtension = file.GetName().Split(
new
char
[]{
'.'
});
// Set a random string as file name
fileNameAndExtension[0] =
"RandomString"
;
// Join new name with file extension
var finalName = fileNameAndExtension[0] +
"."
+ fileNameAndExtension[1];
// Set pah to folder on server
string
path = Server.MapPath(
"~/Uploads/"
);
// Save file with the new name in the given path
file.SaveAs(path + finalName);
}