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.

Comments

agentrickard’s picture

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.

bradfordcp’s picture

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.

agentrickard’s picture

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.

bradfordcp’s picture

Status: Postponed (maintainer needs more info) » Fixed

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

Anonymous’s picture

Status: Fixed » Closed (fixed)

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