Search code examples
phpajaxdatabaseimage-processingautosave

Photo Report PHP Auto Save DB


Good evening folks,

I have a mvc app where picture reports are created. So a user uploads pictures and then writes a description in a text box next to the picture. Sometimes these reports are very long and when there is an interrption (network signal lost, power cut, user hits back by mistake) the whole report is lost and the user has to start all over and its frustrating. So Id like to implement an auto save feature that also saves the picture information along with the descriptions so that the data is not lost is page if refreshed or power is cut... So would that be even possible with multiple pictures (about 40 per report)? Btw only image adresses are stored in the DB. And if its possible whats the best way, Ajax Auto Save?


Solution

  • I'd recommend saving the report to the browser's local storage as it's typed.

    To clarify, I feel that this is more reliable than AJAX, as it doesn't require an internet connection or can't go wrong due to flaky internet.

    As an alternative you could use a cookie, which may work in older browsers and provides an avenue for you to delete it from the PHP side of things.