Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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)
Comments
Comment #1
ericG CreditAttribution: ericG commentedI'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?
Comment #2
quicksketchFileField 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.
Comment #3
RaulMuroc CreditAttribution: RaulMuroc commentedIt 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).
;)