Page 1 of 1

Two simultaneously user unable to upload the file/image

Posted: Sat Feb 17, 2018 3:56 pm
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.


Re: Two simultaneously user unable to upload the file/image

Posted: Sat Feb 17, 2018 4:51 pm
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


Re: Two simultaneously user unable to upload the file/image

Posted: Tue Feb 20, 2018 1:51 pm
by Webmaster

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


Re: Two simultaneously user unable to upload the file/image

Posted: Sat Feb 24, 2018 1:18 pm
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


Re: Two simultaneously user unable to upload the file/image

Posted: Mon Feb 26, 2018 9:41 am
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);
}
}
}
}
}


Re: Two simultaneously user unable to upload the file/image

Posted: Tue Feb 27, 2018 3:18 pm
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);
}
}
}
}
}


Re: Two simultaneously user unable to upload the file/image

Posted: Wed Feb 28, 2018 9:41 am
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.