Concurrent file upload

Thread is closed for posting
6 posts, 0 answers
  1. Robert
    Robert avatar
    55 posts
    Member since:
    Aug 2008

    Posted 03 Nov 2008 Link to this post

    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
  2. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 03 Nov 2008 Link to this post

    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.
  3. Robert
    Robert avatar
    55 posts
    Member since:
    Aug 2008

    Posted 04 Nov 2008 Link to this post

    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
  4. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 04 Nov 2008 Link to this post

    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.
  5. Robert
    Robert avatar
    55 posts
    Member since:
    Aug 2008

    Posted 04 Nov 2008 Link to this post

    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
  6. Alaa Majzoub
    Alaa Majzoub avatar
    49 posts
    Member since:
    Nov 2007

    Posted 18 Dec 2008 Link to this post

    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.


Back to Top