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:

  1. #208224: Allow files from server
  2. #257220: Specifying a file already uploaded (The main point of this feature request is somewhat different, but this is mentioned as a secondary issue.)
  3. http://drupal.org/node/291934#comment-974574
  4. 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:

  1. Uses field_file_save_file() to copy a file from some import directory (set in the field/widget's settings).
  2. Adds a text widget that autocompletes filenames.
  3. 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.
  4. Adds two permissions - one to import files at all, and one to see the listing of files.
  5. 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):

  1. 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
  2. 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.
  3. 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

dopry’s picture

for 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...

darksayings’s picture

Thanks.
I think I'll make some changes (usable isn't the same as finished) and keep it a separate module.

jdschroeder’s picture

How 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.

psicomante’s picture

+1 following

glidetothehoop’s picture

Any 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.

scroogie’s picture

Subscribing. It would be awesome if it would get a nice UI (like the media browsers in Wordpress, Serendipity, Joomla etc.).

mbiddlecombe’s picture

subscribing

stoltoguzzi’s picture

subscribing

dopry’s picture

Status: Active » Closed (fixed)

thanks 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.

elally’s picture

subscribing

nk_’s picture

subscribing

perandre’s picture

Sub

glidetothehoop’s picture

@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!

momper’s picture

subscribing

problue solutions’s picture

no sign of this yet? I really need this functionality too

batje’s picture

subscribe

marklein’s picture

subscribe

wilk4’s picture

subscribe

kjv1611’s picture

Looks like no updates in a while? Any progress?

momper’s picture

http://drupal.org/project/filefield_sources maybe this is interesting for somebody