Document storage path
bradfordcp - July 8, 2008 - 05:37
| Project: | Document Import API |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Jump to:
Description
Should the user's uid be part of the path to where the file is saved. This would prevent different users from overwriting eachother's files.

#1
Or, if we add UID to {docapi_library}, then we could check this during the upload sequence.
In that case, we could prompt the user for what to do -- with the default option being to rename the file. Note that upload.module silently renames files that already exist. (So you get mydoc.doc and mydoc_1.doc, mydoc_2.doc.)
So by default, just appending a version number should be the standard, I think.
#2
I added uid last night to {docapi_library}, should I append the doc_id to the filename? Possibly inserting the record into the db with the tmp path. Then after a doc_id is generated, move the file to the correct directory with the doc_id appended to it. From here we would simple update the db with the new path.
#3
d.o. appends a version id to the filename during the transfer from /temp to /files, based on the "overwrite file" setting.
You can lean on file_save_upload() for this.
See http://api.drupal.org/api/function/file_save_upload/6
For most of the file handling that you need to do, file.inc has functions that cover your needs.
#4
I think this has been fixed in the latest revision...
#5
Automatically closed -- issue fixed for two weeks with no activity.