• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.4 Search for attachment based on filename/path

#1
I have a tricky problem. I need to remove a file from my server (under pain of death) but I'm not sure where it is.

All I have is the raw path
e.g.
http://mysite.com/attachments/mysteriousfile.jpg.370682/

I can access that file.

Now how do I work backwards to locate the post/thread associated with that file, in order to cleanly remove it?

Note: I have hundreds of thousands of files and literally millions of posts/threads.
 
#3
That assumes I know the date. I don't.

But I did try that, and for whatever reason in the 370xxx zone, it's not there. No idea why that would be.

So I assumed there must be something going on that I am not aware of regarding nomenclature.
 

Brogan

XenForo moderator
Staff member
#4
If you have the file name then you can use PhpMyAdmin to search the attachment_data table, which will provide the id, user and date.
Code:
SELECT * FROM `xf_attachment_data` WHERE `filename` LIKE '%mysteriousfile%'
 
#5
Thank you @Brogan

It's too bad there's not a better way to do it in Xenoro (e.g. searching attachments by filename, sorting by filename, having an attachment.php input that takes us to the thread/user etc.) but I suppose it's a bit of a niche thing...