preSaveTempId

3 posts by 2 authors in: Forums > CMS Builder
Last Post: April 21, 2011   (RSS)

By Perchpole - April 21, 2011

I've just been looking at the Uploads table when I discovered a column called preSaveTempId...

What is it for?

:o/

Perch

Re: [Perchpole] preSaveTempId

By Dave - April 21, 2011

Hi Perch,

It's a way of keeping track of uploads for records that haven't been created yet.

When you upload files CMSB stores the tablename, fieldname, and record number the file was uploaded for so it knows which record the upload "belongs" to.

But when you are creating a new record there is no record num yet because the record has never been saved. So when displaying the add record form but "before-save" (preSave) we create a temporary id code (TempId) of random characters that is associated with the new record

When you upload files to a new record it stores this preSaveTempId, and when you save the record for the first time it looks for files uploaded with that preSaveTempId and "adopts" them (blanking out the preSaveTempId field and setting the recordNum field).

And uploads that aren't adopted by a record within 24 hours and removed.

Hopefully that makes sense. Feel free to ask any other questions.
Dave Edis - Senior Developer
interactivetools.com