Better documentation for working with uploaded files?
Hi! Is there a better source for documentation on how to work with uploaded files than http://drupal.org/node/111782 [the handbook's page]? The list of function for working with files on api.drupal.org is not particularly helpful, and the handbook page is also rather sparse. Specifically, I want to have users upload seven files (all of which must be there), and then save them in a directory *which may not be a subdirectory of the Drupal files directory*. Also, I don't want Drupal's file upload size restrictions to apply for this one use. Or, in this case, would it make sense to just ignore the Drupal file functions and use $_FILES and the php file handling code directly? Would this adversely affect the FormAPI stuff? Would I be able to use a _validate function if I'm not using the Drupal file handling functions? Thanks, Ricky The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.
On 7/12/07, Richard Morse <remorse@partners.org> wrote:
Hi! Is there a better source for documentation on how to work with uploaded files than http://drupal.org/node/111782 [the handbook's page]? The list of function for working with files on api.drupal.org is not particularly helpful, and the handbook page is also rather sparse.
Did you look at the example module: http://cvs.drupal.org/viewcvs/drupal/contributions/docs/developer/examples/f...
Specifically, I want to have users upload seven files (all of which must be there), and then save them in a directory *which may not be a subdirectory of the Drupal files directory*. Also, I don't want Drupal's file upload size restrictions to apply for this one use.
Or, in this case, would it make sense to just ignore the Drupal file functions and use $_FILES and the php file handling code directly? Would this adversely affect the FormAPI stuff? Would I be able to use a _validate function if I'm not using the Drupal file handling functions?
You can do it that way but you'll find that as obtuse as they may be, Drupal's file functions are there to help prevent security exploits. I'd be very careful doing it by hand. andrew
On Jul 12, 2007, at 8:10 PM, andrew morton wrote:
Did you look at the example module: http://cvs.drupal.org/viewcvs/drupal/contributions/docs/developer/ examples/fileupload.module?rev=1.6&view=markup
No -- thank you for pointing this out. Is this linked off of api.drupal.org anywhere?
You can do it that way but you'll find that as obtuse as they may be, Drupal's file functions are there to help prevent security exploits. I'd be very careful doing it by hand.
One problem I've discovered by reading through the various functions and trying to figure out what they do is that they seem to require the files to be in the Drupal files directory. Sadly, this is not compatible with the particular task at hand... Ricky The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.
Richard, Interestingly, I am working right now on an API module to help with exactly this sort of thing. It's not as easy as it should be. I've had to build this sort of thing for a couple clients in the past, and now I'm trying to package it in a way that could be used by the community. I'll CC you when its ready for wide audience consumption. You should tune into the discussion at http://groups.drupal.org/file-api Also, if you use CCK, you may find the filefield module is just what you need, except for the part about where it is saved. -Dave On Thu, 12 Jul 2007 14:35:10 -0400, "Richard Morse" <remorse@partners.org> said:
Hi! Is there a better source for documentation on how to work with uploaded files than http://drupal.org/node/111782 [the handbook's page]? The list of function for working with files on api.drupal.org is not particularly helpful, and the handbook page is also rather sparse.
Specifically, I want to have users upload seven files (all of which must be there), and then save them in a directory *which may not be a subdirectory of the Drupal files directory*. Also, I don't want Drupal's file upload size restrictions to apply for this one use.
Or, in this case, would it make sense to just ignore the Drupal file functions and use $_FILES and the php file handling code directly? Would this adversely affect the FormAPI stuff? Would I be able to use a _validate function if I'm not using the Drupal file handling functions?
Thanks, Ricky
The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.
On Jul 12, 2007, at 9:26 PM, David Cohen wrote:
Interestingly, I am working right now on an API module to help with exactly this sort of thing. It's not as easy as it should be.
Thanks!
Also, if you use CCK, you may find the filefield module is just what you need, except for the part about where it is saved.
Unfortunately, not only is the location where it is being saved very important, I also need to specify the names for the uploaded files, and I'm not working with nodes... Ricky The information transmitted in this electronic communication is intended only for the person or entity to whom it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited. If you received this information in error, please contact the Compliance HelpLine at 800-856-1983 and properly dispose of this information.
participants (3)
-
andrew morton -
David Cohen -
Richard Morse