Not sure if you can, but can't you just edit the post, copy all the text and UBB Code in the post, delete the post, then repost it without the attachment?
This is not effective in our scenerio. This would be OK, IF there were a higher root level in the Categories(which I have also been trying to make work <img border="0" title="" alt="[Confused]" src="images/icons/confused.gif" /> ) BUT, I need to always have the original postings available without being deleted and their sub-postings replied onto them.
Dave's code is awesome and what I've needed for months.
I used to keep a generic type "attachment removed" graphic, and I would rename it to the name of the attachment I wanted to remove, and upload it manually to my server.. thus when they clicked the attachement... they got my graphic instead of the real attachment.
Dave's code has been filed away. I've used it 3 times since yesterday.
AWESOME!!
Now why can't they add a little button under "editpost.php" that performs that command and labeled "remove attachment" as part of the standard release?
Sorry, I should have looked in the upload directory <img border="0" title="" alt="[Smile]" src="images/icons/smile.gif" />
So, it's all clear now to me: w3t_Posts.B_File holds either NULL or POSTNUMBER-ATTACHMENTname w3t_Posts.B_Number holds the relevant POSTNUMBER
From Dave's script above: UPDATE w3t_Posts SET B_File = NULL WHERE B_Number = xxxxxx
This will change the attribute to NULL for that posting so it doesn't think it has an attachment. But, this still doesn't delete the associated attachment from the filesystem.
Can any script savvy person do the following: Query the DB to retrieve the present value of B_File in w3t_Posts by asking you for the B_Number AND THEN run Dave's update above to set it to NULL, AND THEN use the $config['files'] variable to use the path and put the attachment name at the end of the path, as the file to delete in the script ? <img border="0" title="" alt="[Eek!]" src="images/icons/shocked.gif" />
OR, better yet...can INFOPOP make a button that will do that ?
I'm not script savvy... but it sounds possible to me.
This should DEFINATELY be a FEATURE standard in the next version.
You should be able to click "Edit" on the post....and then click a button to "remove the attachment"... or even get creative and add or replace the attachment.
This sounds like a feature we definitely need to add. I'll make sure we put it on our drawing board for a future release. You should be able to delete or change any file attachment you upload for a post.
[quote]Originally posted by Dave_L: The only way to do this is to manually delete the file from the server, and clear the relevant column in the database.
I think this would be the correct query, where xxxxxx is the post number:
<pre>UPDATE w3t_Posts SET B_File = NULL WHERE B_Number = xxxxxx[/code]
Type it as one unique string and then press enter to execute. You won't want to try to execute it between lines as shown as it's not a complete query until you are done with it <img border="0" title="" alt="[Smile]" src="images/icons/smile.gif" />
What is this program? I usually log right into the mysql db and query, etc.... Is this a web-interface to mysql ? Is it safe, security wise, if your server is on the internet?
I use phpMyAdmin, and can affirm that it's a worthwhile tool. It's free, and not difficult to install, so you won't lose much by trying it out.
It is a potential security risk. The documentation explains two or three methods to protect it. I put it in a password-protected directory, and also used a randomish directory name to make it hard to find.
phpMyAdmin assumes that you already know how to use MySQL. It just provides a GUI for accessing the database(s).
You have to be careful using it. It's easy to change or delete content from the database with a click or two.
I use both phpMyAdmin and also the mysql command on the server.
Most of the time, I use phpMyAdmin because it's easier. And it saves me the trouble of starting up my SSH client and logging into the server.
Using the mysql command was helpful in learning MySQL, and it's essential in some situations, such as when I have the web server turned off for maintenance. It's also preferable if you're doing time-consuming operations that might result in CGI timeouts.
If you're comfortable using mysql directly, and don't feel any need for a GUI interface, then stick with it. <img border="0" title="" alt="[Smile]" src="images/icons/smile.gif" />
Thanks Dave, I'll take that into concideration and maybe give it a try after I get some other things worked out that are on the plate right now.
ALSO, While I was discussing something with Brett, he mentioned that you can see side-by-side multiple tables for comparisom...now that's something I would install for <img border="0" title="" alt="[Wink]" src="images/icons/wink.gif" />
I use multiple ssh sessions and the old ALT+TAB to accomplish this now <img border="0" title="" alt="[Roll Eyes]" src="images/icons/rolleyes.gif" />
I haven't seen that feature in phpMyAdmin 2.2.6. Maybe it's in 2.3.0, which is still in beta. I suggest asking Brett. When you find out, please post it. <img border="0" title="" alt="[Smile]" src="images/icons/smile.gif" />
I just spoke with Brett after seeing your posting and inquired about how to do this...
He said that you have to run two instances at the same time and run them side-by-side, each connected to the appropriate DB. So it looks like I was (ASS(U(ME)))ing it was all within the one instance of the tool <img border="0" title="" alt="[Embarrassed]" src="images/icons/blush.gif" />
Appologies...
I will attempt it this way, just to see, but this is really no different than me using two SSH sessions with the old ALT+TAB again <img border="0" title="" alt="[Razz]" src="images/icons/tongue.gif" />