Skip Navigation

[Resolved] CRED form with uploading files

This thread is resolved. Here is a description of the problem and solution.

Problem:
Delete the files uploaded using CRED forms

Solution:
You can not delete the uploaded file. This is a drawback as there is no way to identify whether or not those media files have been used elsewhere on the site at that point. For now, these Media Library items will remain stored in your site files.

You can find proposed solution, in this case, with the following reply:
https://toolset.com/forums/topic/cred-form-with-uploading-files/#post-844449

Relevant Documentation:

This support ticket is created 6 years, 6 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by PiotrO586 6 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#832164

Hi,

I have a front-end form which allows attaching files to the CTP. I noticed that when I upload a file and than remove it and upload another one before submitting the form:
1. the first file is still on a server
2. the media post is created from the first file

How to prevent it?

EDIT:
I noticed that prior the form is submitted, the media posts are marked as CRED Auto Draft. But if I remove and upload couple of files before I submit the form, after form submission all the "auto drafts" are attached to the same CTP, not only the last one. Is it desired behavior? It's like all the unwanted files before the form is submitted remain in the media library.

#840182

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - unfortunately - we do not automatically remove attachments that were added to those draft posts. The reason is that we have no way of knowing whether those images have been used elsewhere on the site. So for now, the images will remain in the Media Library indefinitely.

As said - this is expected behavior and there is no solution to it as of now. We have internal ticket with our Devs and its already known to us. We will try to improve this in near future when our Devs find some way and better solution to handle this situation.

#843535

When I upload a file before I submit the form, the file is attached to the media library as auto draft. I read somewhere on the forum that these drafts are automatically removed after some time, is that correct? I don't think that these drafts would be used anywhere on a website, as these are actually temporary files, not even confirmed (submitted). So I think that only these files uploaded along with a form should be converted from auto drafts to proper attachments in media library, not the ones that were deleted from the form before it was submitted (and now they become proper attachments even though they were deleted before the form was submitted).

#844449

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

When I upload a file before I submit the form, the file is attached to the media library as auto draft. I read somewhere on the forum that these drafts are automatically removed after some time, is that correct?
=> Yes, CRED Auto Draft posts are deleted after 4 hours.

I don't think that these drafts would be used anywhere on a website, as these are actually temporary files, not even confirmed (submitted). So I think that only these files uploaded along with a form should be converted from auto drafts to proper attachments in media library, not the ones that were deleted from the form before it was submitted (and now they become proper attachments even though they were deleted before the form was submitted).
==> Yes - this is a drawback as I tried to explain that there is no way to identify whether or not those media files have been used elsewhere on the site at that point. For now, these Media Library items will remain stored in your site files.

#875887

Ok, thank you.