IMCE 2 makes some very good inroads towards proper file management, including hook_file() support and reference counting. In #830696: IMCE integration improvements, ufku suggested enabling all IMCE features like uploading and file deletion when using the 2.x version of the module. I think that IMCE is still a little too liberal with its options (such as allowing uploads to be created anywhere) such that some control is still needed to prevent unwanted creation of thumbnails and uploading of files.
So in order to enable uploading/deletion in IMCE 2, I think we just need a few configuration options in the IMCE FileField Source settings:
IMCE Mode:
(•) File browser only
( ) Full IMCE profile (uploading, deletion, thumbnails, etc. if allowed)
Fine-grain control of options would be locked down through the normal IMCE profile settings.
Comment | File | Size | Author |
---|---|---|---|
#63 | filefield_sources-7.x-877452-63.patch | 6.62 KB | Andrew M Riley |
#62 | filefield_sources-7.x-877452-62.patch | 6.62 KB | mpotter |
#27 | filefield_sources-6.x-877452-27.patch | 6.03 KB | ufku |
#27 | filefield_sources-7.x-877452-27.patch | 6.52 KB | ufku |
#27 | imce.inc.zip | 6.97 KB | ufku |
Comments
Comment #1
quicksketchAfter checking the IMCE 2 options further, I see that you can restrict functionality per-directory, but setting up IMCE to only allow uploading in the proper FileField upload directory per-field would still be a pretty big hassle. It seems to me that the IMCE FileField Source should be responsible for restricting uploading/deletion to the FileField upload path, rather than requiring the user to set up matching configuration options at admin/settings/imce for each field.
Comment #2
ufku CreditAttribution: ufku commentedAttached is a patch for demonstrating how IMCE settings can be overridden by field settings for field upload directory.
This is the IMCE profile process function used in the patch.
Comment #3
ufku CreditAttribution: ufku commentedIMO, if a restriction is to be applied it should
- cover all the field's settings
- disable directory navigation
- enable uploading to the field directory even if IMCE profile does not allow
- disable all IMCE permissions except upload.
This is the only way to mimic the default upload widget.
If this not our goal, then i'm for disabling all restrictions.
Comment #4
ufku CreditAttribution: ufku commentedI think there should be a IMCE mode setting, as you suggested.
- full IMCE
- file browser (shows only the field directory and works for everyone regardless of IMCE permissions)
Comment #5
quicksketchIf we make the options for "Full" or "Browser only", would it make sense to allow uploading and deletion within that restricted directory also? Since they can't delete any files that are in use by other nodes, it's not very dangerous. Then again, having the ability to delete but not have it work for most files isn't very useful either.
So far I completely agree with all your ideas. If restricting down the browser, it should essentially function the same as the "Reference Existing" auto-complete field, but with a visual interface.
Comment #6
geerlingguy CreditAttribution: geerlingguy commentedI'm fully behind the ideas in #3 - that would be perfect!
Comment #7
Anonymous (not verified) CreditAttribution: Anonymous commentedThis setting would be a great add-on. I am migrating from imceimage and the lack of buttons in the imce window coming from filefield_sources is a pain. I also use imce_crop and sometimes imce_mkdir... both things that could be useful if the upload button reappears.
Also, the theme seems to be overridden as well. I'm already theming imce with imce_kama so as part of the "full experience" can we allow external imce themes to be applied too? I thought that was working with v 1.1 but I could be mistaken.
Thanks
Comment #8
agerson CreditAttribution: agerson commentedI too am coming from imceimage and we really miss the resize options. I am all for this feature.
Comment #9
arlinsandbulte CreditAttribution: arlinsandbulte commented+1... to full IMCE integration (upload, delete, mkdir).
AND, if this gets implemented, an option should be added so the default upload widget can be disabled (see attached screen shot), but that is probably another issue: #898002: IMCE integration UX improvements.
Is there any technical reason that IMCE upload directory needs to be the same as the filefield upload directory?
I think the IMCE permission options could be kept as is... if the admin wishes, they could restrict the permissions using the normal IMCE settings.
Comment #10
valderama CreditAttribution: valderama commentedsubscribing.
The things ufku mentioned in#3 would allow a strong file management solution with field_field and IMCE. Therfor I hope that setting will be available soon.
PS: If someone needs full IMCE functionality from within file_field one could try the patch by ufku here: http://drupal.org/node/830696
Comment #11
ufku CreditAttribution: ufku commentedThis patch introduces 2 browser modes:
1- Restricted:
- The only available directory is the field directory (even if it isn't defined in IMCE profiles).
- File list contains only the field files. (like in auto-complete reference)
- No file operations are allowed.
2- Full:
- Directories are defined by IMCE profiles.
- File list contains only the files that exist in DB.
- File operations are allowed for only IMCE6.x-2.x or above.
A third mode allowing upload to field directory by inheriting field settings was canceled because it was getting too complex.
Comment #12
BarwonHack CreditAttribution: BarwonHack commentedSubscribing
Comment #13
shopdogg CreditAttribution: shopdogg commentedsubscribing
Comment #14
MiMe CreditAttribution: MiMe commentedGreat patch!
The only thing I'm missing is an option where you can enable/disable the default Upload so that File browser takes over completely.
With Upload still in place users will get confused on which one to use, especially since the Upload is the default one.
Oh, and if you are using private files in Drupal you might want to check out my patch for imagefield #931540: Images have wrong path when using private files and absolute Windows file directory
Comment #15
kendouglass CreditAttribution: kendouglass commentedI have been using patch #11 by ufku on a few sites and it appears to work fine in both browser modes. It makes FileField Sources much more useful. Thank you!
Comment #16
dubois CreditAttribution: dubois commentedI second #14 by MiMe. I'd like to offer my users an integrated image management interface across fields with filefield_sources and in WYSIWYG editing - entirely replacing the upload module with IMCE.
Comment #17
redkilian CreditAttribution: redkilian commentedsubscribe
Comment #18
mansspams CreditAttribution: mansspams commentedsubscribing. #11 works.
Comment #19
ikeigenwijs CreditAttribution: ikeigenwijs commentedsubscribing
Comment #20
mansspams CreditAttribution: mansspams commentedComment #21
spgd01 CreditAttribution: spgd01 commentedSubscribe
Comment #22
jhedstromHere is the same patch as in #11, but made from the module root instead of the sources subdirectory.
Comment #23
yang_yi_cn CreditAttribution: yang_yi_cn commented#11 works for me.
Actually I prefer using IMCE to manage files instead of automatically create directory by filefield. In my case I'm migrating from an old site with was using imceimage and there are about 6,000 image files created by the content team. The images are already organized by directories and sub-directories, and there are about 500 directories. I don't think filefield is smart enough to manage these files in a better structure.
Comment #24
oliveyrc CreditAttribution: oliveyrc commentedsubscribe
Comment #25
nateB CreditAttribution: nateB commentedIs this patch applicable, or working, in the latest 6x-1.4 build of the module?
Comment #26
axooh CreditAttribution: axooh commentedSubscribe.
What about a patch for Drupal 7?
Comment #27
ufku CreditAttribution: ufku commentedHere are the latest patches for 6.x and 7.x.
6.x is almost the same as the previous patch.
I've also attached imce.inc files for those who don't know how to apply patches.
Comment #28
paskainos CreditAttribution: paskainos commentedsubscribing
Comment #29
jayson CreditAttribution: jayson commentedsubscribing
Comment #30
jaypark CreditAttribution: jaypark commentedapplied the patch in #27 - getting this warning when attempting to upload via imce:
warning: imagejpeg() [function.imagejpeg]: SAFE MODE Restriction in effect. The script whose uid is 0 is not allowed to access /var/www/vhosts/site.com/httpdocs/sites/default/files/imagefield_thumbs/images owned by uid 48 in /var/www/vhosts/site.com/httpdocs/sites/all/modules/imageapi/imageapi_gd.module on line 66.
warning: imagejpeg() [function.imagejpeg]: Invalid filename in /var/www/vhosts/site.com/httpdocs/sites/all/modules/imageapi/imageapi_gd.module on line 66.
Comment #31
dwalker51 CreditAttribution: dwalker51 commented+1
Comment #32
momper CreditAttribution: momper commentedsubscribe
Comment #33
deshiknaves CreditAttribution: deshiknaves commentedsubscribe
Comment #34
tsvenson CreditAttribution: tsvenson commentedSubbing, this will greatly improve productivity for content authors.
Comment #35
ufku CreditAttribution: ufku commentedIt would be very helpful if subscribers also reviewed the patches supplied in #27.
Comment #36
tsvenson CreditAttribution: tsvenson commented@ufku: That's my plan, just need to finish up some other related stuff before. Plan is to test the patch tomorrow.
Comment #37
momper CreditAttribution: momper commentedsub
Comment #38
weekbeforenextI replaced the sources/imce.inc file with #27. It seems to be working well.
Comment #39
Ireneo CreditAttribution: Ireneo commentedHi, I replaced the .inc file and selected "Full: Browsable directories are defined by IMCE configuration profiles" but when I go to the IMCE configuration page, the only definable browsable directories appear to be in the sites/default/files/ directory which is no different than before. What am I missing?
Comment #40
decibel.places CreditAttribution: decibel.places commentedI also require the IMCE functions upload and especially crop and resize - so the 6x patch in #27 works for me!
For the record, some plugins for IMCE exist that address some of the security concerns that led to the decision to disable all IMCE functions in filefield_sources except for Browse and Insert:
IMCE Tools (part of the whitehouse.gov project)
http://drupal.org/project/imce_tools
IMCE Directory Manager
This module provides an interface for specifying which directories a user can access via the IMCE module. It is useful when you have users which have the same Drupal roles but need to be confined to directories which can not be derived from user data.
IMCE Search
This module provides a search box on the IMCE interface for searching the files table based on current directory path. This won’t find all files uploaded matching the search criteria but it will find any recorded in the files table.
IMCE File Path
This module provides a status bar type interface in the IMCE window listing the path to a file which makes it easy to build a link to a file instead of embedding it.
IMCE Mkdir
http://drupal.org/project/imce_mkdir
IMCE Mkdir allows users to create and delete sub-directories under directories assigned by IMCE.
IMCE Rename
http://drupal.org/project/imce_rename
Comment #41
decibel.places CreditAttribution: decibel.places commented@#39
be sure to create an IMCE profile with the directory permissions you need AND assign it to a role at admin/settings/imce
Comment #42
code-brighton CreditAttribution: code-brighton commentedI used the patch in #27 and worked for me. Thank you ufku.
But I also had to make changes sited here: http://drupal.org/node/436182#comment-4668498 due to the following error when trying to upload some files "The selected file could not be used because the file does not exist in the database"
All works now.
Comment #43
Greg Varga CreditAttribution: Greg Varga commentedsub.
Comment #44
tostinni CreditAttribution: tostinni commented#27 works great on D7, thanks ufku.
Comment #45
decibel.places CreditAttribution: decibel.places commentedFYI, We have shifted the image crop and resize functions to the Imagefield Focus module
Using Filefield Sources there is an upload option too. If you need to be able to delete existing/uploaded files, then IMCE with the patch in #27 is good option
Comment #46
spgd01 CreditAttribution: spgd01 commentedworks
Comment #47
NetWorks-1 CreditAttribution: NetWorks-1 commentedi deleted my post: think before posting! ^^
Comment #48
kerios83 CreditAttribution: kerios83 commentedpatch from #27 is working with 7.x.1.5 ? There is no file imce.inc in the package so attached files in #27 won't work... You also cant choose Version -> 7.x.1.5 in Edit issue settings.
@ufku can u Attach property files for version 7.x.1.5 ? Thx.
Comment #49
Draco CreditAttribution: Draco commented#27 not work for me
@ufku
Please, can you tell me about this code:
Why apply filter to the default IMCE directory scan?
This is move lose files uploaded by FTP
Comment #50
ufku CreditAttribution: ufku commented@Draco, a file must be registered in db in order to be used in a file field. That's why there is a db filtering.
OTH, the patches in #27 do not aim to solve FTP file issue. They are provided to allow file operations in IMCE by introducing a Full Mode browser which has to be activated in field settings.
@quicksketch, can you please share your ideas on these patches? It's been a long time and many reviews. Any chance they can get committed?
Comment #51
Draco CreditAttribution: Draco commentedOk. Any ideas about loses FTP file issue?
Comment #52
ufku CreditAttribution: ufku commentedI've created a sandbox project to solve all IMCE-filefield issues. It's a standalone module independent of filefield sources. I may promote it to a full project if it gets enough attention.It's now a full project.
Comment #53
mariomaric CreditAttribution: mariomaric commented@ufku: so, your sandbox project is replacement for FileField Sources module when people want to use IMCE w/ FileField?
Cool, will try it this weekend..
Comment #54
garbo CreditAttribution: garbo commented@ ufku: I tested your sandbox a on 6.x and it seems to work well. Applied it together with the patch from #27.
Comment #55
mariomaric CreditAttribution: mariomaric commented@ufku: I posted my feedback in #1383988: "Add a new file" forms disappear issue..
Cheers.
Comment #56
kressin CreditAttribution: kressin commentedFile field works great with 7.12. Thanks a lot for the module, it was just what I needed. Great work. I am not sure if I missed the issue mentioned @#14 concerning deactivating standard upload and using IMCE instead. I had the issue of users uploading with standard upload and (of course) not finding the files in IMCE. It led to some confusion so I would like to bring up the topic again of a method to deactivate standard upload. Any ideas?
Comment #57
decibel.places CreditAttribution: decibel.places commented@kressin
perhaps you could unset the upload with hook_form_alter
or hide it with CSS and/or jQuery (note: may not be standards-compliant for accessibility)
Comment #58
BioALIEN CreditAttribution: BioALIEN commentedMy comments on #436182: IMCE lists unusable files (The selected file could not be used because the file does not exist in the database) are directly related to this issue. ufku seems to have a working solution so why not merge these patches into FileField Sources?
Comment #59
kerios83 CreditAttribution: kerios83 commentedInteresting idea.
Comment #60
mpotter CreditAttribution: mpotter commented#27 working for me here on v7.12. Really seems like it's time to get this patch committed!
Just a minor whitespace issue:
Comment #61
ingram87 CreditAttribution: ingram87 commented@kressin #56
I would like to see a way to remove the standard upload field/button and force the user to use IMCE as well
Comment #62
mpotter CreditAttribution: mpotter commentedActually, I have an important change to this patch:
Without Filefield Sources installed, IMCE shows all buttons (from various other modules, such as IMCE Tools as discussed in #40). After installing Filefield Sources, even with the patch in #27 installed, these buttons are removed by default, impacting other modules that hook into File Fields.
The proper operation of FileField Sources would be that File fields with no Sources selected should continue to work as they did before FileField Sources was installed. That can be accomplished with the patch in this issue if the default IMCE Mode is set to FULL instead of Restricted.
The patch included here is a simple re-roll of #27 with the default IMCE Mode set to Full instead of Restricted. This allows a site to continue working as expected after FileField Sources is installed.
Setting this back to Needs Review to allow more comments on this change of default behavior.
Comment #63
Andrew M Riley CreditAttribution: Andrew M Riley commentedThe patch in #62 worked for me against dev. There was a warning about a trailing space on line 49 so I fixed it and re-rolled the patch.
Comment #64
Agileware CreditAttribution: Agileware commented#63 works for me, thanks!
Comment #65
Ayesh CreditAttribution: Ayesh commented#63 + the patch at http://drupal.org/node/436182#comment-4733018 worked for me!
Comment #66
quicksketchOver a year later, I've finally committed ufku's #27. Sorry everyone I've been occupied with other modules. FileField Sources always was sort of an experiment that I thought was kind of cool but didn't think would be as popular as it became gain this much attention (and all the maintenance that entails).
Regarding @mpotter's #62 (and the followup #63) patch, IMCE *does* continue to behave exactly like before FileField Sources is installed, it's only that IMCE behaves more conservatively when used on a FileField. Since there isn't an IMCE browser on FileFields before FileField Source is enabled, there's no need to maintain consistency with something that didn't exist beforehand.
I still prefer the restricted mode and think it makes the most sense for FileField users, but since I last experimented with IMCE a lot of the caveats it used to have are now corrected. You can't just delete files that are in use elsewhere, it properly tracks its own file usages now, etc. I know ufku fixed those problems a *long* time ago, but I don't regularly use IMCE on my own sites to see the improvements.
In any case, committed to both branches. There will be a new release out later this week.
Comment #68
Agileware CreditAttribution: Agileware commented@quicksketch - any chance you can pls push out a release which includes this fix?
Comment #69
quicksketchThe 1.6 version includes these changes.
Comment #70
mxhThose ideas are often the big ones. Many thanks to your awesome work.