This is a migrated thread and some comments may be shown as answers.

Concurrent file upload

5 Answers 111 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Robert
Top achievements
Rank 1
Robert asked on 03 Nov 2008, 01:47 PM
Hi,

I've integrated RadUpload into my application. There is one question that I have: What happens if different users upload files with the same name? If user A upoads a file called 'myfile.txt' and then user B uploads a file with the same name, will die file by user A be overwritten?
If users upload two files at the same time, does the UploadedFiles collection always refer to the "correct" files (the ones uploaded within the current session)?

Best regards,
Robert

5 Answers, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 03 Nov 2008, 03:32 PM
Hi Robert,

Up to your questions:
  • The file overwrite depends on the OverwriteExistingFiles property (if the TargetFolder or TargetPhysicalFolder properties of RadUpload are set). You can use an event handler to the FileExists event to rename the file in a custom manner when it already exists.
  • Yes, the uploaded files are unique per each request, so multiple simultaneous uploads will not interfere.
I hope this helps.

Kind regards,
Erjan Gavalji
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Robert
Top achievements
Rank 1
answered on 04 Nov 2008, 08:29 AM
Hi Erjan,

thank you for your explanation. When a file is uploaded to my application, I iterate through UploadedFiles and insert the file content into a database. Afterwards I delete the uploaded file from TargetPhysicalFolder.
If I understand your statement correctly, simultaneous uploads of files with the same name would not cause any problems here, isn't it?

Best regards,
Robert
0
Erjan Gavalji
Telerik team
answered on 04 Nov 2008, 09:50 AM
Hi Robert,

Actually that could cause problems. You can remove the TargePhysicalFolder and save the files by using UploadedFile's InputStream property, which would give you the binary content of the file ready to save to the database.

With this approach you will use the temporary files, created by the .NET Framework, which are automatically deleted when the page execution finishes.

I hope this helps.

Kind regards,
Erjan Gavalji
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Robert
Top achievements
Rank 1
answered on 04 Nov 2008, 11:43 AM
Hi Erjan,

that is exactly what I want :). I never tried not to provide a TargetFolder or
TargetPhysicalFolder - I assumed one of these Properties has to be provided.

Thanks!
Robert
0
Alaa Majzoub
Top achievements
Rank 2
answered on 18 Dec 2008, 07:23 AM
Hello Erjan,

we are having the case where file are getting mixed between sessions!!!

we suspect that this has to do when concurrent users are using same IP address, but we are not sure of that.


Tags
Upload (Obsolete)
Asked by
Robert
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
Robert
Top achievements
Rank 1
Alaa Majzoub
Top achievements
Rank 2
Share this question
or