On shared hosting with strict memory and time limits, FileField isn't usable for things like audio or video. The field_file_save_file() function allows importing a file that's already uploaded, but users need a way to access that functionality.
According to these places, I'm not the only one with this concern:
- #208224: Allow files from server
- #257220: Specifying a file already uploaded (The main point of this feature request is somewhat different, but this is mentioned as a secondary issue.)
- http://drupal.org/node/291934#comment-974574
- http://mustardseedmedia.com/podcast/episode17#comment-141
I've written a module that adds a choice of two widgets that allow importing existing files rather than uploading local files. It has a lot of room for improvement, but it's perfectly usable now.
Some of the things it does are:
- Uses field_file_save_file() to copy a file from some import directory (set in the field/widget's settings).
- Adds a text widget that autocompletes filenames.
- Adds a widget that uses a select element, configurable as either a drop-down list or a list box, containing a list of files available to be imported.
- Adds two permissions - one to import files at all, and one to see the listing of files.
- If the user doesn't have permission to view the directory listing, degrades either widget to a plain text area without autocomplete.
These are some things it doesn't do (at least, not currently):
- Allow two nodes to point to the same file. It copies the file, so one node would point to, e.g. file.txt, and the other would have file_0.txt
- Allow a user to choose either to import an existing file or upload a new file with a single widget. I think the difficulty here is more a UI problem of presenting the choice in a way that makes sense than a technical problem of implementing it.
- Detect whether the import path and destination path are the same (to prevent file renaming issues). My approach would be to document in huge, bold, underlined, red, all-caps letters with circles around it that it's not recommended, but to allow it if you feel you need to - it won't break anything.
As this is written, it's a separate module. Would it be better to keep it separate, apply for CVS access, and create a new project? Or would it be better to rework it into a patch to be reviewed here?
Comments
Comment #1
dopry commentedfor inclusion in filefield you should implement it as a filefield widget. You can either choose to release it in it's own module or submit it for inclusion in filefield...
Comment #2
darksayings commentedThanks.
I think I'll make some changes (usable isn't the same as finished) and keep it a separate module.
Comment #3
jdschroeder commentedHow is the progress on this module? I have this very issue on a client site, and would be willing to do some testing if it's available in a beta stage.
Comment #4
psicomante commented+1 following
Comment #5
glidetothehoop commentedAny update on the availability of this import capability for FileField? I'm trying to figure out the best way to import a bunch of audio files.
Comment #6
scroogie commentedSubscribing. It would be awesome if it would get a nice UI (like the media browsers in Wordpress, Serendipity, Joomla etc.).
Comment #7
mbiddlecombe commentedsubscribing
Comment #8
stoltoguzzi commentedsubscribing
Comment #9
dopry commentedthanks darksayings.. good luck with your development... let me know when you think it's in good shape and I'll add a link to it to the filefield page. I really look forward to seeing it.
Comment #10
elally commentedsubscribing
Comment #11
nk_ commentedsubscribing
Comment #12
perandre commentedSub
Comment #13
glidetothehoop commented@darksayings: is the module you've made for importing available yet? If not, how would you suggesting I import files into a filefield that already exist on my webserver?
Thanks!
Comment #14
momper commentedsubscribing
Comment #15
problue solutionsno sign of this yet? I really need this functionality too
Comment #16
batje commentedsubscribe
Comment #17
marklein commentedsubscribe
Comment #18
wilk4 commentedsubscribe
Comment #19
kjv1611 commentedLooks like no updates in a while? Any progress?
Comment #20
momper commentedhttp://drupal.org/project/filefield_sources maybe this is interesting for somebody