Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7093567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:27:20+00:00 2026-05-28T08:27:20+00:00

Does anyone know the best way to deal with concurrent uploads and what todo

  • 0

Does anyone know the best way to deal with concurrent uploads and what todo if a user only partially uploads a file and then quits for some reason? (or their internet dies).

Here’s my controller: http://pastebin.com/wqnFAge6

And the model: http://pastebin.com/0S5ai2re

the upload in the controller

           if($this->input->post('upload')) {               
                    $uploaded_image_ids = $this->Site_model->do_upload();
                    //$uploaded_image_id = $this->Site_model->get_last();

                    $values = array(
                    'image_id' => implode(",",$uploaded_image_ids),
                    'session_id' => $this->session->set_userdata('session_id')
                    );
                    $this->session->set_userdata('edit', $values);

                    //show uploaded image
                    redirect(implode(",",$uploaded_image_ids) . '?links');

            }

All is working well now except if i attempt to upload multiple files at once it’ll skip generating a thumbnail for one sometimes, also if an upload is cut off it leaves the uploaded file in /images/<- instead of removing it like it should after an upload and processing is done.

Any idea how I can fix these issues? Many thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:27:20+00:00Added an answer on May 28, 2026 at 8:27 am

    If your client should lose his connection while uploading files via POST the traditional way (without AJAX1) hence breaking the upload, your controller will never be executed since the request body has no end marker.

    As for concurrent uploads; there is no such thing (except maybe with AJAX1). When a user uploads several files in one form, these are processed serially. Here‘s a little guide I found by googling to handle multiple uploads.

    1 Since there are various different implementations of asynchronous file uploads and I’m not familiar with all of them, this answer may be invalid for at least one of them.


    Edit:

    In PHP your application is launched per-request so there is no concurrency at that level; no two request will be served from the same instance of your application. However, assuming that you are working with a single DB, two instances of your app may access the same resource concurrently and it’s your DB engines’s responsibility to handle them. You can still screw up on the application level by not using transactions where you should for instance, but as long as you CRUD your DB correctly, your application will not have to handle concurrency explicitly.

    As for your code, I don’t have the time to learn it thoroughly as to give you a definitive yes/no answer, but if you are sure that per each uploaded image there’s an entry in your DB and when updating an image the corresponding data will as well be updated in the DB, then you will have no trouble handling several such requests simultaneously.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know the best way to create a SQL Server CE (Compact 3.5)
does anyone know the best way to insert a column in a datatable at
Does anyone know the best way to limit the number of rows returned when
Does anyone know the best way to set the background of a row or
Is it possible, or does anyone know the best way to capture MSN chats?
Does anyone know the best way to insert some text into an XWiki document
Does anyone know the best way I can create a configuration for a Console/Command-line
Does anyone know the best way to check to see if an optional protocol
Does anyone know the best way to get the UTC offset in WP7? Apparently
Does anyone know of any best practices or 'standard' techniques for implementing authentication between

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.