Page 1 of 5

Update attachment

Posted: Wed May 21, 2008 7:53 pm
by Extensions Robot
Modification name: Update attachment
Author: rxu
Modification description: This mod adds an "Update attachment" button to upload attachments form.
Modification version: 1.0.3
Tested on phpBB version: 3.0.1

Download file: Update_attachment_1.0.3.zip
File size: 30951 Bytes

Modification overview page: View

The phpBB Team is not responsible nor required to provide support for this modification. By installing this MOD, you acknowledge that the phpBB Support Team or phpBB Modifications Team may not be able to provide support.

-->Modification support<--

Update attachment

Posted: Wed May 21, 2008 7:53 pm
by Paul
Modification validated/released

Notes:

Update attachment

Posted: Wed May 21, 2008 7:53 pm
by rxu
Thanks, Paul :)

The MOD adds an "Update attachment" button to the posting form. This button is to upload new versions of already uploaded attchmments so download/vew count and attachment id (download link) will be keeped.
This feature is similar to the one from File attachment MOD for phpBB2 by Acyd Burn.

Re: Update attachment

Posted: Wed May 21, 2008 8:13 pm
by DaannO
What does this do then?

Re: Update attachment

Posted: Wed May 21, 2008 8:19 pm
by SAFFLEUR
DaannO wrote:What does this do then?
This mod adds an "Update attachment" button to upload attachments form.

It let's you update the attachment on your post.

Re: Update attachment

Posted: Thu May 22, 2008 5:48 am
by stokerpiller
I am not sure that I get this?
Update attachment, why?

Can You attach a new zip file and keep the download count?

Re: Update attachment

Posted: Thu May 22, 2008 11:53 am
by alecrust
I think I understand what it does, but if you could explain it better I'm sure it would be helpful for everyone.

Re: Update attachment

Posted: Thu May 22, 2008 12:53 pm
by rxu

Re: Update attachment

Posted: Fri May 23, 2008 7:08 am
by karlsemple
I think the confusion lies in the fact the update button is not added to the file upload box(obviously) and thus it does not appear there is way to attach a new file to 'update' the existing file.


If I understand right you need to browse and select a file in the normal upload manor and then click "update file" on the file you wish to be updated....?

Re: Update attachment

Posted: Fri May 23, 2008 9:29 am
by stokerpiller
Okay, now it is testet and it is working GREAT :mrgreen:

This is exactly what it does:
You have a post with an attached file.
The file needs to be updated and You click the Edit button.

Click the Upload attachment, find the new file at Your computer BUT DONT click to add the file.
If You want You can change the description.
Click the Update file button instead, see pic:
Image

Then the file is updated.

Re: Update attachment

Posted: Fri May 23, 2008 1:08 pm
by rxu
Sorry for the bad MOD description guys. :?
karlsemple wrote:If I understand right you need to browse and select a file in the normal upload manor and then click "update file" on the file you wish to be updated....?
Exactly, Karl :)
stokerpiller wrote:Okay, now it is testet and it is working GREAT
Thanks for the testing and explanation :D

Re: Update attachment

Posted: Tue May 27, 2008 8:28 am
by stokerpiller
When an administrator try to update a users attachment, we get this error:

Code: Select all

General Error
You are not allowed to access this file.
Please notify the board administrator or webmaster:......

Re: Update attachment

Posted: Thu May 29, 2008 10:23 pm
by ErnadoO
Yes, because in this case, poster_id in phpbb_attachments is changed, and this query (in message_parser.php):

Code: Select all

        // Regenerate already posted attachments
        if (sizeof($not_orphan))
        {
            // Get the attachment data, based on the poster id...
            $sql = 'SELECT attach_id, is_orphan, real_filename, attach_comment
                FROM ' . ATTACHMENTS_TABLE . '
                WHERE ' . $db->sql_in_set('attach_id', array_keys($not_orphan)) . '
                    AND poster_id = ' . $check_user_id;
            $result = $db->sql_query($sql);

            while ($row = $db->sql_fetchrow($result))
            {
                $pos = $not_orphan[$row['attach_id']];
                $this->attachment_data[$pos] = $row;
                set_var($this->attachment_data[$pos]['attach_comment'], $_POST['attachment_data'][$pos]['attach_comment'], 'string', true);

                unset($not_orphan[$row['attach_id']]);
            }
            $db->sql_freeresult($result);
        }

        if (sizeof($not_orphan))
        {
            trigger_error('NO_ACCESS_ATTACHMENT', E_USER_ERROR);
        } 
not return all attached files.
So, $not_orphan is not empty after the loop => trigger_error() ;)

Re: Update attachment

Posted: Mon Jun 02, 2008 11:44 am
by mcdanielnc89
then why was this mod validated if that's kind of really a major error.

Re: Update attachment

Posted: Mon Jun 02, 2008 1:09 pm
by stokerpiller
mcdanielnc89 wrote:then why was this mod validated if that's kind of really a major error.
Well, I like it to be fixed too.
But nobody promised me that Admins where able to update users attachments ;)