Two simultaneously user unable to upload the file/image

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
prem01628
User
Posts: 23

Two simultaneously user unable to upload the file/image

Post by prem01628 »

when single user upload the multiple files (max 5 in settings) he can upload the jpg, xlsx, pdf etc.
but when second another user visit the same page on another PC and try to upload the image or file
first user's file ready to save (which were uploaded and shown in thumbnail) removed from server (temp__599bf8e9-f438-5e00-0bca-4e1280f6cfe3)
and if first user add the record in this situation his file doesn't show later or downloaded.


kirondedshem
User
Posts: 642

Post by kirondedshem »

I have also expirinced the same problem with ASP.NET 2018, although my attachments where not multiple, but i still saw when i upload and image 1.png to record 1 and then I try to upload the same image to record 2, the image in record 1 diapperas and is assigned to record and vice versa.

I was busy on something else at that time so i thought i would go and revisit it later, But seeing this point has made me remember the issue


Webmaster
User
Posts: 9425

Post by Webmaster »

If you are a registered user, please update to the latest template (click Tools -> Update Template) and try again.


prem01628
User
Posts: 23

Post by prem01628 »

When tried to update Message appears Existing teplate is up-to-date.
Then i also Delete Template Cache and regenerate the all files and build the project.
The problem remains same. When second user from another pc open same page for upload, it delete the first users 'temp9d0fad0b-4b34-ad17-060c-61f5ad025d85' folder where the files were ready to uploaded and create the new 'temp7a2c6fbc-3590-95a4-e2d9-e637918882fc' folder for second user. after saving the both records first user is unable to download the uploaded file


Webmaster
User
Posts: 9425

Post by Webmaster »

It should work. Are you sure you are using the latest template? Note that we are referring to ASP.NET Maker 2018 (NOT older versions which are no longer updated)

Check the template file "aspnetfn.cs". The new codes should look like below (see line marked with ***):

public static void CleanUploadTempPaths(string sessionid = "")
{
//...
foreach (var dirInfo in subDirs) {
var subfolder = dirInfo.Name;
var tempfolder = dirInfo.FullName;
if (Config.UploadTempFolderPrefix + sessionid == subfolder) { // Clean session folder
CleanPath(tempfolder, true);
} else {
if (Config.UploadTempFolderPrefix + Session.SessionId != subfolder) {
if (IsEmptyPath(tempfolder)) { // Empty folder
CleanPath(tempfolder, true);
} else { // Old folder
var lastmdtime = dirInfo.LastWriteTime;
if (((TimeSpan)(DateTime.Now - lastmdtime)).Minutes > Config.UploadTempFolderTimeLimit) //***
CleanPath(tempfolder, true);
}
}
}
}
}


prem01628
User
Posts: 23

Post by prem01628 »

I am using ASP.NET Maker v2017.0.2 with updated templage

template file "aspxfn.cs". The codes look like below :

// Clean temp upload folders
public static void ew_CleanUploadTempPaths(string sessionid = "")
{
var folder = ew_UploadPathEx(true, EW_UPLOAD_DEST_PATH);
if (!Directory.Exists(folder))
return;
var dir = new DirectoryInfo(folder);
var subDirs = dir.GetDirectories(EW_UPLOAD_TEMP_FOLDER_PREFIX + "");
foreach (var dirInfo in subDirs) {
var subfolder = dirInfo.Name;
var tempfolder = dirInfo.FullName;
if (EW_UPLOAD_TEMP_FOLDER_PREFIX + sessionid == subfolder) { // Clean session folder
ew_CleanPath(tempfolder, true);
} else {
if (EW_UPLOAD_TEMP_FOLDER_PREFIX + ew_Session.SessionID != subfolder) {
if (ew_IsEmptyPath(tempfolder)) { // Empty folder
ew_CleanPath(tempfolder, true);
} else { // Old folder
var lastmdtime = dirInfo.CreationTime;
var files = dirInfo.GetFiles("
.*");
if (((TimeSpan)(DateTime.Now - lastmdtime)).Minutes / 60 > EW_UPLOAD_TEMP_FOLDER_TIME_LIMIT || files != null && files.Length == 0)
ew_CleanPath(tempfolder, true);
}
}
}
}
}


Webmaster
User
Posts: 9425

Post by Webmaster »

As explained:
Note that we are referring to ASP.NET Maker 2018 (NOT older versions which are no longer updated)

For earlier versions, please see the line marked with *** and make the change yourself.


Post Reply