Fix conflict with Upload path
Christefano - December 4, 2007 - 04:11
| Project: | Private Upload |
| Version: | 5.x-1.0-rc2 |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
While troubleshooting 197154 I found a conflict when creating a private or public upload when the Upload path module is enabled. Files are attached successfully but Upload path's use of tokens in the file path are broken.

#1
Great, I will add this to the list of known issues.
#2
@starbow,
First of all, thanq for such module.
Wanted to let you know what i have:
-Both Private Upload 6.x-1.0-rc2 & Upload path 6.x-1.0 enabled
-at
admin/settings/file-systemFile system path is set tosites/default/files-at
admin/settings/uploadpathDefault pattern for the file path prefix is set toprivate/[type]/[yyyy]/[mm]-create a page and upload a file within that page & click save
-i get this message
-then i edit that page again, don't change anything on it, just click save and… I GET NO ERROR MESSAGE :)
-Check the file and see that it's successfully in place ==>>
private/[type]/[yyyy]/[mm]/file_uploaded.jpgHope this could help you find the problem, as i think it's a bug.
What do you think, as i would like to use both modules on my site —not the dev— and not sure if it's secured or not —as i'm not getting anyother error messages—
Last but not least, i also get this under
admin/reports/statusThx, and really wish you could find a solution.
Cheers!
:)
N.B.:
[type]/[yyyy]/[mm]is authomatically created when i save the page.#3
#4
@starbow,
Thank you for your response. But i'd like to say:
-When you create a new node
-under File attachments-Attach new file: choose file
-click Attach
-Un-check the "Private" checkbox
-Save node
This way you never get the error message, above explained, and the file goes perfectly to its place with no problem.
So i am not sure if this is really a clear feature request category as it's working o.k. this way, and has that bug the other way!
Please need more info to know what to do.
Thank you so much for your time & for such module, as i really would like to use.
#5
I've found that there seems to be a similar issue with uploadpath 5.x-1.1 (not -dev!). I can set the base upload path and define the upload area to be "private", and uploads are put into the correct place. That is,
I go to: Administer -> Site configuration -> File system
I set the "File system path:" to: sites/www/content/files
I set the "Download method" to: Private
and "Save configuration". I then configure access to download pages:
I go to: Administer -> User management -> Access control
I enable "view uploaded files" for administrators and authenticated users.
Then I configure uploadpath:
I go to: Administer -> Site configuration -> File upload paths
and set the default pattern and patterns for each node type.
I then upload a file to a node. The file goes into the correct path as defined in the uploadpath config screen. When I view the node as an administrator or authenticated user and look at the upload file link, it points to:
http://my.web.server/system/files/uploaded.file
However this does not resolve to the actual file. I get a "page not found" error.
Any ideas on how to fix this?
Thanks,
Carl
#6
This is something I would like to be solved as well. Now I do not know if any development is done in trying to solve this, but is there something I can do to help, e.g. help in determining the problem or testing?
#7
Furthermore, despite the fact that I do not know whether this adds to the process, but I must agree with errement that this is a bug, not a feature request.
#8
Changed the version as the problem still exists with the recommended version.
#9
Ok, I am in the midst of rewriting this module to cope with upload path. Status so far:
Directory layout
I first tried to put all private files beneath the top level 'private' path. This is difficult and has the disadvantages of not having all files (private or not) in the same place. Furthermore, this would introduce changes to upload path as well, which is undesirable. I am now working on a private dir beneath the public one if needed. So an example (with grouping on nodes) would be:
Directories are created when needed including '.htaccess'.
Node interaction
Files have en extra option 'private'. The following rules apply:
This is still under development.
File movement
Files are moved from the public to the private part and vice-versa. Therefore, the directories have to be created automatically. Deleting a file is done as well, but when no files reside in the directory, the (private) directory is not deleted (I am a bit reluctant to do that and I do not think it is a big disadvantage).
Settings
As directories are created automatically, this will mean less configuration for the user and less checks in advance. (I think this is an advantage, but remarks are welcome.)
Open issues
In order of importance:
Update status report/check section when configuring.Convert to 6.x.I will keep you posted.
#10
#11
Ok, this is the first version I have created and tested. In some of the files I have named this one rc3. Please use for testing purposes only. If you would like to have extensive debug info, please look at the function 'debug' and set the variable 'debugging' to true.
Furthermore, this is my first PHP programme ever and I do not yet know how to do diff's, patches and so on. Please be harsh on the code, but gentle with me ;-) Any remarks are appreciated.
#12
Patch file (created with WinMerge) for version 6.x.
#13
I attempted to apply this patch, but it is not valid.
See http://drupal.org/node/60234 for guidance.
Also, you should know that I am not likely to accept a patch that makes fundamental changes to the module just to implement this feature, unless those changes have other positive impacts.
#14
I will check the guidance section. Thanks.
I am not sure I understand what you are saying. I am trying to solve the conflict with 'Upload path' and I seem to have managed that. If that is not a positive impact, feel free to dismiss it. I myself am pleased with being able to put my files in a more ordered way in stead of a flat directory accompanied with the public/private function and as I saw that there were more members having the same question I thought I would share it. If that is not what you want, I apologize and keep this for myself.
#15
#16
edvanleeuwen: I think it is great that you want to share your work, and it could be very useful to people, especially those stuck on this issue. Please feel free to post your work and share patches. But I don't want you to put in a ton of work, and then be disappointed if your patch does not get rolled into the next version of the module.
But, certainly, if other people use your work, and there is a clamor for it to be added, I will listen to that.
#17
I think that something that helps to remedy the conflict with upload path would be very useful.
#18
subscibing
#19
Would like this conflict resolved as well.
#20
Thanks for the patch. I installed it and it is working the way I like it.
Unfortunately, you introduced an new issue. When attaching a new file to be uploaded and with "default upload privacy settings" set to "private" everything seems to be working fine. When hovering over the attachment you'll notice that the upload privacy setting is "public". This is caused by the fact that, for new attachments, the $file->filepath property does not include the "file directory path" part.
I created a patch to the 6.x-1.0-rc2 version (so it is not a patch to the previous patch).
Enjoy!
#21
Thanks for the update, Jan!
#22
this seems to effect other modules that deal with files. I'm playing with media mover at the moment, and seem to be having similar results.