Uploading files before the table entry is created?
I have a form that creates entries in a database.
The entries should have associated files.
I have an AJAX/HTML5 file upload on the same form.

If a user uploads a file before the database entry is created then I don't have anything to associate with the file.  I'm not sure I can trust session_id() or rand() or microtime() to be unique.  If the database entry is never created, I need a way to detect this and delete the unneeded files.

Suggestions?


Uploading files before the table entry is created?
===

I have a form that creates entries in a database.
The entries should have associated files.
I have an AJAX/HTML5 file upload on the same form.

If a user uploads a file before the database entry is created then I don't have anything to associate with the file.  I'm not sure I can trust session_id() or rand() or microtime() to be unique.  If the database entry is never created, I need a way to detect this and delete the unneeded files.

Suggestions?

