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

pauln60 created an issue. See original summary.

DanChadwick’s picture

Category: Bug report » Support request
Priority: Critical » Normal
Status: Active » Fixed
Issue tags: -uploaded files disapppearing

Almost 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.

pauln60’s picture

Ok - 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.

DanChadwick’s picture

Not 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.

pauln60’s picture

That 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.

DanChadwick’s picture

  1. Delete the submissions.
  2. Delete the webform node.
  3. Modify each submission programmatically (custom code) to remove the file reference, letting webform delete the file.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.