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
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

agentrickard - July 8, 2008 - 18:08
Status:postponed (maintainer needs more info)» active

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

bradfordcp - July 8, 2008 - 18:53
Status:active» postponed (maintainer needs more info)

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

agentrickard - July 9, 2008 - 15:42

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

bradfordcp - August 20, 2008 - 04:30
Status:postponed (maintainer needs more info)» fixed

I think this has been fixed in the latest revision...

#5

Anonymous (not verified) - September 3, 2008 - 04:42
Status:fixed» closed

Automatically closed -- issue fixed for two weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.