I’m really looking for a best approach for how to tackle this one.
I have a page for creating a new object, let’s call it a “Report”.
This is how it needs to perform:
There are the usual text boxes and text areas for creating a report.
I have functionality for ajax uploading documents.
When complete the user clicks “create” and the report is entered in the database.
The Problem
How can I upload documents via Ajax and store them logically in the file system when I don’t yet have a primary key for report? Ideal file system structure would be /upload/docs/[userid]/[reportid]/.
Doing the uploads after the user has created a report isn’t an option due to customer requirements.
Any approach you can suggest would be helpful 🙂 Thanks!
We have similar requirements, and a structure close to yours which is like :
upload/[filetype]/[customer_id]/[file-UUID]We’re creating a Unique ID (timestamp+userID+hash or something like that) then store that file and bind the UUID in the database when the user decide to create his document