Need suggestions on file handling

eridanibrew - April 17, 2009 - 00:19

I am looking for suggestions from more experienced drupalers as to handling files needing to be uploaded by users.

I have a number of users that are entering content (short stories, announcements, etc). They need to upload images to support their text. I would like to set it up so that:

1) They can upload files to a directory they find, or that they create. For example, Fred creates an article about Topic X and has 3 images for the article. I want him to be able to create a folder "Topic X" and upload his files to that folder. He can then insert the html commands to insert the images into his story as desired.

2) I do not want all the images to be in one folder. We currently have that situation on an old site I am replacing, and it is a mess. We have thousands of images all thrown into one folder, no organization and no one knows what image goes with what.

Presumably these folders would be rooted under sites/default/files/SiteImages. It would be convenient to set up different roots for different content types. Thus, Fred would only see the folders under SiteImages; Sally would only see folders under SiteImages/Announcements.

3) I could certainly set up ftp access for the users and go that route. However, these users are not strong with ftp, don't have a nice ftp tool, and are not likely to be comfortable going that route if I can avoid it.

4) It would also be convenient to be able to upload multiple files at a time, rather than having to send 20 images one at a time.

There seem to be a number of different modules around, so I am looking for advice on what to use. I have played around with FileField under CCK, and ImageField. They do not seem to provide what I want. I also looked briefly at SWFUpload - it looks powerful, but a) I don't really know the js, so I would be slow to get comfortable with it, and 2) I couldn't see how the user would select the destination folder.

Perhaps I should be trying a general FileManager module that could do this? Any recommendations?

Thanks for any help,
brew

File field under CCK is nice

jainrutgers - April 17, 2009 - 00:44

File field under CCK is nice option for you. Now how?

1) First of all you need to create different content type for each user.

2) So let say for Fred you created a content type Fred_page. Now add a cck file field to this content type and in configuration set the desired path.

3) Same for Sally create a content type say Sally_announcement and add a cck file field. Set the path for file for this person.

4) You have to set the permission so Fred can create page only using content type Fred_page and Sally can create page only using content type Sally_announcement.

5)Bonus- this will also help you to organize the content under each user.

Chetan

Close, but not quite there

eridanibrew - April 17, 2009 - 02:28

Well, this is what I am currently doing as a stopgap. However, there are a couple of limitations.

1) Fred creates multiple Fred_pages. Each Fred_page should have it's images in its own directory (Fred_page1, Fred_page2, ...). Using the FileField in a content type I can set a folder for Fred_page, but all Fred_pages upload into that same directory. The user can't move around within the folder structure, or create new subfolders.

I may be able to mess around with tokens to make this work, don't know yet. For example, if I use the node title as the subdirectory, what happens when Fred changes the title? What happens with poor characters from the title being used as folder names (like "/")... maybe nid would work, other than being difficult to track back to the nodes without access to the database.

2) The user can only upload a single file. I think I can give him multiple instances of the FileField, but he still has to do 20 separate uploads for 20 images.

3) It seems that when I create a Book, creating child pages only creates Book Pages. I can't seem to get it to create Fred_pages, for example (using the "Add Child Page" link under the Book). Maybe I am missing something - it seems like I should be able to specify the default content type to use for child pages for a book. Thus, when Fred adds a child page, he doesn't get a Fred_page with the nice FileField - he gets a Book Page.

I suppose I could mess around with templates and stuff to change the Add Child Page link, but that seems pretty crude and prone to breakage...

I think I am looking for a FileField with a bit of FileManager capability:)

brew

FileField Paths

Deciphered - June 2, 2009 - 04:52

Hi Brew,

If you use FileField Paths in conjunction with FileField or even just with the default Upload module, you can sort files into a directory per node.

As for multi files, there are a few modules out there that do handle multiple files on top of FileField, Image FUpload is one example.

Cheers,
Deciphered.

 
 

Drupal is a registered trademark of Dries Buytaert.