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

  • Home
  • SEARCH
  • 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 8259365
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:50:44+00:00 2026-06-08T02:50:44+00:00

So let’s say user did something on my website, for example uploaded some images

  • 0

So let’s say user did something on my website, for example uploaded some images or whatever, and he left without logging out and never came back or let’s say he did come back after few months.

So my question would be, is there some kind of way for example to delete his uploaded files after session have expired, let’s say after 30 mins (keep in mind that user never reloaded page), so that would need to run entirely on server side without user interfering at all.

EDIT Thank you all for your wonderful answers, it gave me quite a few great ideas, i wish i could accept all of your answers 🙂

  • 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-06-08T02:50:45+00:00Added an answer on June 8, 2026 at 2:50 am

    One way would be to call

      $thePath = session_save_path();
    

    and iterate over all saved session file, unserialze each and check them for the specified timeout property.

    Unfortunately, you need to scan the whole directory to find all session files, which are older than a defined period of time. You’d use start() to figure out the age of a session file.

    On a well-maintained server, each virtual host should have a separate directory for its session data. A not-so-well-maintained might store all sessions in a unified shared directory. Therefore, ensure that you don’t read or delete other virtual hosts’ session data.

    Better Approach using a database

    Therefore I propose to save session data to your application’s backend database. Using SQL, it would be trivial to find all outdated session files.

    The documentation for session_set_save_handler() provides a sample, which explains this whole process quite nicely based on objects.

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

Sidebar

Related Questions

Let's say I want to have some kind of a cache that did something
Let me try to explain by example. Say website is hosted at example.com (NOT
Let's say I have a method in java, which looks up a user in
Let me explain best with an example. Say you have node class that can
Let's say I have window.open (without name parameter), scattered in my project and I
Let's say I have the following text: (example) <table> <tr> <td> <span>col1</span> </td> <td>col2</td>
Let's say I have an facebook application running using the JS SDK. First user
Let's say there is a graph and some set of functions like: create-node ::
Let's assume that a user votes for some movies in a scale of 1
Let say I've this URL: http://example.com/image-title/987654/ I want to insert download to the part

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.