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 have a webform with a file field, and uploaded files are stored in a directory tagged with the authenticated user's name - seems to work well, uploaded test files appear in the right place in the file system. However, they are all deleted overnight. Anyone have any idea why?
Thanks for any input,
P.
Comments
Comment #2
DanChadwick CreditAttribution: DanChadwick commentedAlmost certainly not a webform bug. I'd venture that either the submissions weren't actually saved (e.g. the file was uploaded with the upload button, but the submission wasn't saved), or something deleted the submission or the webform node.
When the submission is either not saved, the uploaded file is considered temporary and is deleted by the system cron job. You could disable cron for a while to see if that prevents the files from being deleted. Or perhaps you are using a module like Webform Clear which deletes submissions.
I also recommend you update to the latest stable release. Good luck. Please feel free to re-open if you debug further and need more ideas. You also might try hiring a developer to look at the site.
Comment #3
pauln60 CreditAttribution: pauln60 commentedOk - I don't think the webforms were being submitted, so presumably the files were being deleted by cron. So I cleaned up the old entries (deleted any existing files)... however, the filenames and locations are still showing up - so how do you cleanly delete a previously uploaded file?
Thanks,
P.
Comment #4
DanChadwick CreditAttribution: DanChadwick commentedNot sure what you did, but you don't have to do anything to clean up a previously uploaded file. Cron will delete the database entries and then actually delete (aka unlink) the file itself.
Comment #5
pauln60 CreditAttribution: pauln60 commentedThat works for files belonging to webforms that have a file upload field and the file webform was never submitted. But now I have files in the filesystem that belong to webforms that were submitted, and now the issue is: how are these deleted cleanly (i.e., remove them from database and the filesystem)?
Another issue: if I create two file fields in the same form, and upload two separate files, when the form is submitted, only the first one is saved. Is that 'as designed', or a bug?
Thanks
P.
Comment #6
DanChadwick CreditAttribution: DanChadwick commented