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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:21:02+00:00 2026-06-10T15:21:02+00:00

I am saving user’s uploaded file on the disk and just storing filename in

  • 0

I am saving user’s uploaded file on the disk and just storing filename in database. I want to write a code such that if record is inserted and file is saved on disk then only it should commit. If record is created in DB but file could not be saved due to permission issue etc I want the whole transaction to be rolled back. Obviously this cannot be done using SqlTransaction

How should I ensure this type of integrity of datda?

  • 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-10T15:21:04+00:00Added an answer on June 10, 2026 at 3:21 pm

    I usually do one of the following for non-transactional tasks that need some management (or, in your case, something that is difficult to include in a transaction):

    1) Perform the non-transactional task last. If it fails then there should be nothing to worry about since the transaction is rolled back, e.g.:
    – e-mail not sent
    – file not saved

    2) Use some process/saga that performs a type of “two-phase commit”. Maybe an entry outside of a transaction in a table that indicates that your file saving task has to be verified. Then try your “actual” bit in your transaction (save record, save file). Then another scheduled/ad-hoc service can check whether the task completed and clean up if it did not.

    3) Along the lines of (2): first store the data in a temporary state (more-or-less the way a write-ahead log works). If the state is OK you know the data is all there and you can continue and mark you record as completed or move it to its permanent home. Another scheduled/ad-hoc task can clean up any temporary data if it has expired.

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

Sidebar

Related Questions

I have to write an extension for saving user credentials to my database server
Using VB6 I am saving the user the entry in the database. Code. rst.Open
I am saving the user image in application domain file system. and the storing
With the following code below, There is an error saying File /home/user/web_pro/info/views.py, line 184,
I'm trying to save the name of a Facebook user upon saving that user,
I am saving user-submitted HTML (in a database). I must prevent JavaScript injection attacks.
I want to emulate a user saving a webpage into a directory (after login)
Before saving the user entered data I want to check whether the entered data
I have seen two different approaches in saving user preferences. APPROACH 1: Serializing them
I am having problem saving additional information about each user automatically when a new

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.