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

Discussion in 'Troubleshooting and Problems' started by chompy, Apr 2, 2015.

  1. chompy

    chompy Member

    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.
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    You can use the Attachment Browser in the ACP - filter on date.
     
  3. chompy

    chompy Member

    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.
     
  4. Brogan

    Brogan XenForo Moderator Staff Member

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

    chompy Member

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

Share This Page