Storing Images before loading to SQL

I have a perspective project where a user will answer a few questions about a product and then takes up to 5 photos of the product. The photos will get stored to a file directory and the info will be stored in SLQ. I don't want anything stored until the user hits submit.

What would be a best practice for holding the photos in a queue before I send them to get loaded to the file directory? The photo sizes are around 2MB each

Store them in a temp folder, and move them to the correct folder on confirm
and empty the temp folder afterwards (because

I know you don't want to, but I would store them in the database with an upload timestamp column and a boolean "completed" indicator (which will be left FALSE until the operation is completed).

  • Saving the uploads is now just a matter of toggling the completed column.
  • Cancel will delete the uploads.
  • A scheduled query can delete any images that are not completed and older than a predetermined time.

I'd use my Integration Toolkit's pageVarMap() to hold them in memory until you are ready. You should clean it out after loading to the DB, but if you forget, it will be discarded when the page is destroyed.

2 Likes