How can I upload files to a Grid view and save them in a specific format? Specifically, I want the uploaded files to be saved with the naming convention name_time_device. Can someone assist me with this process?
Here is the code snippet I am using for file uploading and saving:
if (context.Request.Files.Count > 0)
{
HttpFileCollection files = context.Request.Files;
for (int i = 0; i < files.Count; i++)
{
HttpPostedFile file = files[i];
string fname = context.Server.MapPath("~/uploads/" + file.FileName);
file.SaveAs(fname);
}
context.Response.ContentType = "application/x-zip-compressed";
context.Response.Write("File Uploaded Successfully!");
}
Currently, I am using javascript for file uploading and saving. The files are zipped and saved in the uploads folder. However, I need them to be saved as name_id_date_device.zip.
Furthermore, I have a function that utilizes ajax calls for file saving. This generic handler is used to save the files.
While saving the files through this function, how can I pass the id_name_device to ensure that each user's files are saved accordingly?
Any assistance would be greatly appreciated.