HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Image Upload
nithish
New
Hey,
When you upload a file in a discussion, the file is saved in the uploads
folder even if the user does not post (submit) the discussion. Is there any way to save files only if the user has submitted the discussion?
Thanks!
Tagged:
0
Comments
@R_J any thoughts?
Detecting what uploads are still in use is not trivial.
For example:
Unused images are nothing to worry about unless you are close to running out of hard drive space.
If you are worried about server space check the (relatively) new image upload limits found under /settings/posting.
If you want to moderate all uploaded content, there is also a commercial plugin available.
My themes: pure | minusbaseline - My plugins: CSSedit | HTMLedit | InfiniteScroll | BirthdayModule | [all] - PM me about customizations
VanillaSkins.com - Plugins, Themes and Graphics for Vanillaforums OS
Bleistivt already gave the best answer.
But just a technical addition: as long as the draft exists, you surely don't want to delete the upload. Therefore only if a draft is deleted you might consider deleting the uploades files, too. But neither the model nor the controllers delete method fires an event. Therefore I'd say there is no clean way to do so.
But I agree that those uploads are nothing to worry about.
The only thing you can do is to run a script which:
a) exports all databases (except for the GDN_Media table)
b) gather all file names from the the uploads folder
c) try to find each of those file names in the database dump
d) delete all files which file names can not be found in the database dump
But honestly: that sounds like a non trivial scripts which eats up a lot of resources and the gain from that is minimal.
But maybe you have some specific need that requires something similar. Could you explain why you've asked?
Yeah, that seems like a lot of tedious work.
I asked only because the images will simply occupy space and are of no use (if user ignores draft).