Closed (duplicate)
Project:
FileField
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
11 Oct 2008 at 11:45 UTC
Updated:
17 Apr 2009 at 02:03 UTC
Jump to comment: Most recent file
Comments
Comment #1
trogie commentedOK, I was looking into the filefield widget functions. And currently looking at the filefield_paths module how the filefield API works.
Does anybody think a filefield dependent extra module could 'easily' be implemented to do these things:
-add extra checkbox under the permitted file extensions in the content type filefield configuration settings to permit zip files of the above specified file extensions.
-extend the upload validation to allow these zip files
-add extra functionality to 'unzip' the zipfile and verify the individual files in the zipfile (file extensions, filesizes,...)
-update the filefields in the 'node_add' form to display the validated individual files
I would really like this feature for my next websites (especially for the picture albums) and can spend some time to implement it myself but a little extra help on how to start with it would be very welcome off course(filefield API documentation eg)!
Comment #2
trogie commentedFirst things are done already (checking for php zip extension, checkbox in the field configuration settings)
Now I'm trying to find out a way to validate a zip file after uploading a file but before the normal filefield file validation and others take over... any ideas?
Comment #3
twowheeler commentedYou know, the Gallerix module already does this very well. The user can upload a zip file, and the server opens it and allows the user to enter a description for each file before adding them to a photo gallery. It is a great feature and would add a lot here. It might be possible to siphon some code out of the gallerix module, or at least get some ideas of how to do it.
Comment #4
trogie commentedThanks. yes, there are a lot of modules who implement some kind of 'unzipping' but almost all of them are creating their own forms and so are not using any cck functionality. I prefer not to reinvent the hot water again... Having this feature for filefield would also enable all modules that depend on filefield...
Comment #5
trogie commentedok, for filefield I can already upload zipfiles and uncompress it. With imagefield I have a problem that there is a validator set (filefield_validate_is_image) and that one returns an error off course for the zip file... No idea yet how I could solve this.
Comment #6
attiks commentedanybody has already some code to share / test?
Comment #7
Flying Drupalist commentedsubscribe :)
Comment #8
Dimm commentedhttp://drupal.org/node/251096
+1
Comment #9
trogie commented@attiks:
I don't have any code online yet. In the code I have currently I'm not actually unzipping (just looping over the zipfile and outputting some debug info). When I'm done with the unzipping I'll put the highly development code online. After that I think I'll need some help for pushing back the individual files information to the uploading client if there's javascript involved...
@dimm:
I know about the imagefield patch for zipfiles on D5, but I have always seen this functionality more general and as imagefield depends on filefield, it was my idea that filefield should have this feature. Imagine a content type that can have multiple pdf files attached (filefield) is not very different to a content type with multiple images (imagefield). A problem I forsee with imagefield is that the zipfile should get uncompressed and accepted before the filefield_file_is_image validation function gets called...
Comment #10
Dimm commented@ trogie:
I begin write code to upload zip to imagefield
May be it help you.
Comment #11
dopry commented@trogie: I suggest you try doing your work in #process... It can be quite aggravating to debug, but the results could be promising since you can add all your files to the form at this point.. You may need to rebuild/override some validation logic... I should have drawn up a flow chart of the form processing when I implemented all of that originally.
Comment #12
quicksketchDimm linked to it above, but there's a matching issue in the ImageField queue that does the same thing: #251096: Upload multiple images at once (archive/php_zip support).
Comment #13
quicksketchI'm marking this duplicate and moving #251096 to the FileField queue.