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 7689677
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:13:10+00:00 2026-05-31T20:13:10+00:00

I have got a the following problem: I have got multi-step form where in

  • 0

I have got a the following problem: I have got multi-step form where in one step user upload image to server and then few steps further supplies other information, when this information is invalid no data should be commited – also the image should be deleted.

I was thinking about PHP session, but I’ve read here PHP – Store Images in SESSION data? that it is inefficient way. Every time you proceed step in the form the image is reloaded (in the session) and as somebody mentioned “You will want it to only be as big as it needs to be and you need to delete it as soon as you don’t need it because large pieces of information in the session will slow down the session startup.” – here i got a question: will it slow down the stratup the session of user who upload file or sessions of all users?

I have to mention that I’m looking for solution that doesn’t rely on operating system scripts (cron or etc) – I have no permission to run such scripts.

The perfect solution for me would be: saving image on disk (for example in some folder named after session id) then after the latest step of form move this image or delete depending on form validation. If user unexpectedly destroy the session (for example closing the browser) of course the folder with image should be deleted. In nutshell I need somethig like callback to event “destroying session”.

  • 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-31T20:13:12+00:00Added an answer on May 31, 2026 at 8:13 pm

    The best solution would be to save the image in on the disk in a temporary location. You can then store the filename of the file in the user’s session.

    Regarding cleaning up orphaned sessions, you can write your own session save handler and set it using session_set_save_handler().

    Effectively, you will need to write your own handlers for opening, saving, reading, writing, destroying and garbage collecting sessions.

    In your case, you would have an extra bit of code in the destroying and garbage collecting that also removes unwanted images connected to that session.

    Here’s a pretty good blog post about writing your own custom session handler. The example uses MySQL as the storage backend, but you should be able to adapt it to your storage handler of choice.

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

Sidebar

Related Questions

I have got the following problem since the server has safe mode turned on,
I've got the following problem: I have two tables: (simplified) +--------+ +-----------+ | User
I've got the following (simplified) problem: I have a entity in a Many-To-One relationship:
Ive got the following problem. I have a model called user which has a
I have the following problem: I got a view with two text fields and
i have got the following problem: I want to create a new Liferay Theme
I really couldn't find how to resolve the following problem. I have got: <TextBlock
I've got the following problem: I have rhtml (html minced together with ruby inside
I have got the following SQL statement (SQL Server): DECLARE @atr nvarchar(255), @con nvarchar(1000),
I got the following problem: I have 2 databases, let's say DB1 and DB2

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.