I create custom form including the filefield field, and I want to set the default value to filefield.
But I can not get the success result.
Is that possible? (And I can not load the form from node, since the form is not a node form)


ericG’s picture

I'm having the same problem. using filefield with an image allows for defaults to be set but file with file upload does not. Did you ever figure out this issue or a usable workaround?

quicksketch’s picture

Priority: Critical » Normal
Status: Active » Closed (won't fix)

FileField does not have the ability to set a default file. This changed in Drupal 7, but it's unlikely that the D6 version will receive this feature.

RaulMuroc’s picture

It is for security reasons. Imagine you lead an Upload form that it get default file from DB or disk folder.

If I creaet an script which deletes part of your webpage (or corrupts it) and I just find the way to upload in the directory or DB where your files are saved with the same name than one existing (overwritting it), then will take my malicious script as a default file in your form without any kind of testing as it is supposed to have passed the optional secure methods to validate files at the form.

That's really dangerous! People would trust your website, just click on the file with consequences. No way is nice that!

Otherwise, if they have to upload through your form, you have the opportunity to scan that file with secure methods (not obligated, if you don't pass validation tests then is the same at the end, no security at all).