1

Topic: Adding file types to attachment mod

Frank H

The site I run requires that AutoCAD file types .dwg, .dxf and .dwf can be uploaded. How do I add these (I assume it means adding them to attach.php)?

I've been down so long it's beginning to look like up..

Re: Adding file types to attachment mod

They are not on auto ignore, so you don't need to alter any php files. (unless you want to add mime for them, if the browser fail to set them)



But you should be able to control this in the admin interface.

Go to the Forums page, and for the forum you want to allow those files, klick the link 'Forum Attachment Rules'

there you find a field called "Allowed fileextentions"

there you just write what file extentions you want to allow (if it's empty it will allow all files, that is not on auto ignore hardcoded, in attach.php)

so, if you already have
txt jpg jpeg gif png
there ... just add so it becomes
txt jpg jpeg gif png dwg dxf dwg

if it's empty, it should allow the files ....

3

Re: Adding file types to attachment mod

O.K.

I had the files empty because I wanted to allow all except those banned. It would not allow .dwf files to be attached (we had to zip it and then attach it).
I prefer to leave files empty because I would probably forget to include a type that someone was trying to upload.
What do you mean by mime? How do I find out what mime type?


BTW: I just tried to edit a posting while logged in as administrator. I wanted to add an attachment but it wouldn't let me. Is this intentional (cannot add attachment to someone elses post even if administrator) or is it a glitch?

I've been down so long it's beginning to look like up..

Re: Adding file types to attachment mod

First of all, administrators bypass all sort of checks (except max hardcoded size), so you should be able to attach any files you want, and I also edited a guest post and added an jpg into that ... (on a clean testforum)

Are you sure the file just wasn't too big? (and thus shrunk in size when zippign it)

if you look in the 'include/attach.php'  and a few lines down you see an array called $attach_always_deny
that's the only files it will deny from normal users.

Make sure the file wasn't too big (it doesn't put out an error message if the file is too large)... be sure to watch the bytes, and not the MB
(as it is 1024 bytes in a kB etc.)... right click the file and view the properties ... and compare with the set limit on the forum (from the admin interface)

Re: Adding file types to attachment mod

oh, and mime is a way to identify a filetype, so it's possible to know what type of file it is...  (check attach.php and you'll see how it looks.)
I use the mimes for the icons also ... I might switch to file extentions later ... (or, probably will)

6 (edited by JohnS 2004-03-05 22:54)

Re: Adding file types to attachment mod

The file certainly wasn't too big. I ended up quoting the original poster and attaching to that. It worked OK doing it that way but wouldn't let me attach when editing a post (I tried 6 or 7 times).
Anyway, it's done now.

Edit:
I've just tried editing several user's postings and it won't let me attach to any of them.
You said you edited a 'guest' posting but my forum is set to deny guests access to attachments for security reasons - don't want unregistered users attaching all sorts of crap!

Second Edit:
Just so as I know I'm not doing things wrong, if anyone else has the attachment mod set up would you please try something for me?
Log in as administrator, edit a topic posted by a registered user and, while doing so, attach a file.
Please let me know your results.

I've been down so long it's beginning to look like up..

Re: Adding file types to attachment mod

I edited a registered users post now (first deleted the attachment, so it wouldn't have any 'link' to an attachment.

Then Edited it with the admin account, and added a jpg into it ... no problems.

was it you that I sent the 'clean attachment mod' to (zipped)?

8 (edited by JohnS 2004-03-06 19:35)

Re: Adding file types to attachment mod

Frank H wrote:

was it you that I sent the 'clean attachment mod' to (zipped)?

I haven't received anything.. unless you mean the stuff you sent me a month ago when I pointed out the problem with guests posting..

I've been down so long it's beginning to look like up..

Re: Adding file types to attachment mod

yep ... that's the files I meant ...

hmm... I think it's an odd thing though, would you like to send a simple dwf file, so I can check the 'clean install' if it is an issue with my code, or if it's something other...  (preferably a small one, think the mail account is choked ... lol) ... my email adress is visible below smile

(sry for replying so late, but I'm moving from Redhat to Debian on my server today ... so prio has been on that ... heh, but now I'm scp:ing over some files, so I could find time to open a cold one and relax a few minutes wink)

10

Re: Adding file types to attachment mod

Done.
I've emailed the actual dwf file we had problems with (although the file itself is fine).
btw: just incase you don't know a .dwf file is an autocad drawing saved in a format for the web.

I've been down so long it's beginning to look like up..

Re: Adding file types to attachment mod

will look on it as soon as I get the server up and running again ... (probably during sunday sometime)

12

Re: Adding file types to attachment mod

Frank

Just an idea (I don't know anything about coding so it could be irrelevant)..

You gave me a fix to overcome the problem with guests access to attachments
http://punbb.org/forums/viewtopic.php?id=3179

I don't suppose this could in any way affect admin rights to post attachments in edits?

I've been down so long it's beginning to look like up..

Re: Adding file types to attachment mod

well it worked for me to edit a post as admin ...

but the system is soon up again ... so I'll test it then... (I think I only have some minor httpd.conf to do now)

Re: Adding file types to attachment mod

have now tested to edit a registered users post, and uploading the dwf file you sent me, without any problems at all...

do you have any other mods, that can be in conflict?

15

Re: Adding file types to attachment mod

I am running PunBB Version 1.1.2 with Attachment and PunPoll mods installed.

I've been down so long it's beginning to look like up..

Re: Adding file types to attachment mod

don't know if PunPoll alters edit.php, but if it does, recheck so that everything in the Attachment mod is there (and that you use the corrections that I posted in the other thread(linked from the release post IIRC))

I guess it's something there, as I managed to do it in the clean 1.1.1 (and that the diffference between 1.1.2 and 1.1.1 is something that shouldn't affect the mod.

17

Re: Adding file types to attachment mod

Sorted. My error. My apologies (I'm sure you can do more with your time than try to solve non-existant problems).

For some reason, when I was updating to PunBB 1.1.2 I overwrote a change I had made earlier...

#---------[ 23. FIND (line: 300) ]--------------------------------------------
#

<form method="post" action="edit.php?id=<?php echo $id ?>&action=edit" id="edit" onsubmit="return process_form(this)">


#
#---------[ 24. REPLACE WITH ]------------------------------------------------
#

<form method="post" enctype="multipart/form-data" action="edit.php?id=<?php echo $id ?>&action=edit" id="edit" onsubmit="return process_form(this)">


and set it back to its original (without the enctype)...

I've updated it now and everything works fine. It just emphasises, though, how careful you need to be when installing mods (especially more than one)

I've been down so long it's beginning to look like up..

18 (edited by Frank H 2004-03-07 23:17)

Re: Adding file types to attachment mod

no problems big_smile
I'm just glad it's sorted out ... smile
and sometimes it's bugs (like last time) ... heh... so it's just good to figure it out what's the cause, instead of giving up wink

and yep, without the enctype, the recieved form doesn't know that there are files shipped with the form (as it's sent as multipart ... I guess separate from the rest of the form data, somehow... wink)


and yep ... in 50 steps ... it's easy to miss one step smile