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)?
You are not logged in. Please login or register.
PunBB Forums → PunBB 1.2 modifications, plugins and integrations → 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)?
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 ....
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?
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)
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)
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 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)?
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..
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
(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 )
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.
will look on it as soon as I get the server up and running again ... (probably during sunday sometime)
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?
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)
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?
I am running PunBB Version 1.1.2 with Attachment and PunPoll mods installed.
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.
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)
no problems
I'm just glad it's sorted out ...
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
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... )
and yep ... in 50 steps ... it's easy to miss one step
PunBB Forums → PunBB 1.2 modifications, plugins and integrations → Adding file types to attachment mod
Powered by PunBB, supported by Informer Technologies, Inc.