proeder's File Attachment Mod 1.0 - Postet den (35058 Views)
Junior Member
proeder
Innlegg: 230
230
09.05.04 - Updated Zip File, link fixed, bugs fixed

(02.05.04: some writing errors in replace files...sorry, fixed)

This a improved version of Mike's File Attachment with a lot of included features worked out by Suhern. Thanks to him!
I built in some more nice features which make this now a real mod I believe:
  • Admin Panel to control all settings
  • File size, extensions, server timeout and uploadfolder configurable
  • Improved error listings, when files are not uploaded - no you know why!
  • Reusing previously uploaded files as easy as uploading a new one
  • In myfiles.asp users may delete files they don't want to use anymore
  • Admins can delete any file in any folder
  • Images are displayed in posts, when feature is turned on
  • Images are thumbnailed in myfiles.asp
  • dbs file and readme included
  • Two language versions: German and english
06.02.04:
  • script for checking invalid characters in filename added
For downloading the mod please follow the link or come to my demoforum
17.02.04:
  • Round function corrected
  • Readme updated
  • Images included
  • Images definded now in inc_iconfiles.asp
  • link in post.asp improved (mouseover with hand style
  • Icons for different file types in admin console added
  • dbs file now without error
For downloading the mod please follow the link or come to my demoforum
Download
[EDIT]IMAGES NOW INCLUDED!!!
Have fun!<
Looking for german Snitz forum? Suchst Du ein deutsches Snitz Forum? Hier findest Du eins...
Hosting with ASP Support available: http://www.sharepointing.com
   
 Sidestørrelse 
Postet den
Retired Support Moderator
MarcelG
Innlegg: 2625
2625
Sounds good!! I'll try to integrate it into oxle!<
Postet den
Junior Member
NorwegianViking
Innlegg: 119
119
Ops! Seems like you have included an unmodified post.asp. I can't find any reference to your MOD in this.
In the documentation it states:
In your forum directory create a folder, name it however you want to and grant write access for anonymous access to this folder.
Does it HAVE to be in the Forum directory, or can it be at the same level as the Forum directory (as with the Database directory)?
Look forward to use this MOD.<
Postet den
Junior Member
proeder
Innlegg: 230
230
First of all: Some changes.
  • I had problems with uploading files containing special characters in the filename, the script would set wrong links in the post then. I fixed that by adding the IsValidString function to the script.
  • Links were not set correctly in the post, fixed that as well
  • Some translations in myfiles.asp were not correct, fixed
  • post.asp did not have the code in it, fixed
The Zip is updated, the link above is fixed to point to the new Zip. Try again!
@NorwegianViking: Unfortunately yes, the uploadfolder needs to be in your forum directory (which certainly may be named different...). I did not find a way to put the uploadfolder elsewhere than in the forum dir as the original script alway uses the actual server mappath method to create the subfolders. I thought of changing that but did not know how to do that. But as I cannot see any disadvantage in using the forum dir I did not put too much effort in findeing a different solution. If there is any big disadvantage let me know, then we would need to find another way...

<
Looking for german Snitz forum? Suchst Du ein deutsches Snitz Forum? Hier findest Du eins...
Hosting with ASP Support available: http://www.sharepointing.com
Postet den
Development Team Leader
Classicmotorcycling
Innlegg: 2085
2085
I have placed this on my forum so Moderators and Admins are the only ones that can post attachments in thier posts. It looks so much better with the new interface.

Did find a couple of issues with the code in post.asp, but that soon fixed up, there was also an issue with the paperclip in the attachment inline. It could not find it, but after some playing about, got hat to work as well.
All up good work Proeder.. <
Cheers,

David Greening
Postet den
Junior Member
NorwegianViking
Innlegg: 119
119
Thanks Proeder

I'll try to implement again tonight.
Classic, would you share your findings?
The issue about the location of the folder:
The only "problem" got to do with implementing new MODs.
To test a new MOD, I create a new folder on the server where I place and test the complete forum with the files for a new MOD. If I always have to have a read/write subdirectory to this, I must contact my ISP everytime I do a MOD. And do a LOT of file copying (files uploaded), because I want to switch to this new directory when I have tested the MOD.
Maybe someone else could give some advise on this?<
Postet den
Advanced Member
Carefree
Innlegg: 4224
4224
Error in dbs:

CREATE TABLE FORUM_UPSIZE( ID int IDENTITY (1, 1) PRIMARY KEY NOT NULL , UPLOAD_VAR text (20) NULL , UPLOAD_VALUE int NULL )
CREATE TABLE FORUM_UPSIZE( ID int IDENTITY (1, 1) PRIMARY KEY NOT NULL , UPLOAD_VAR text (20) NULL , UPLOAD_VALUE int NULL )
9 | Subscript out of range

As for the paperclip icon issue, you need to add the following to the end of your icon list in "inc_iconfiles.asp":

Code:

Const strIconPaperClip = "icon_paperclip.gif|15|15"

Several lines in post.asp need to be modified, the following work:

Code:

     if strAllowAttachment = 1 then
Response.Write "<tr>" & vbNewLine & _
"<td bgColor=""" & strPopUpTableColor & """> </td>" & vbNewLine & _
"<td bgColor=""" & strPopUpTableColor & """ valign=""center"">" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" <a href=""#"" onClick=""window.open('pop_upload_new.asp','Uploading','toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=800,height=330');""><acronym title=""Attach File..."">" & getCurrentIcon(strIconPaperClip,"","") & "</acronym></a><acronym title=""Attach File...""> <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """>To attach a file, click here.</font></acronym><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """><br /></font>" & vbNewLine & _
"</td>" & vbNewLine & _
"</tr>" & vbNewLine
end if

Just a suggestion - the current method works, but it'd look better with the icons for each added filetype to be displayed with the file names in admin_attach.asp (vs current method of showing both a delete icon and the word delete).<
Postet den
Junior Member
proeder
Innlegg: 230
230
Yes I 've seen that myself. Unfortunately I do not know where that comes from. Sorry. But it does not seem to have any bad effects - the tables are created correctly and the mod itself works. If anone knows where the error comes from, let me know. Here is the dbs code:

(most of it I just copied and pasted it from other dbs' I've found - I am not a Database expert... dissapprove
Code:
Attachement Insert
[INSERT] CONFIG_NEW
(C_VARIABLE,C_VALUE)#('STRALLOWATTACHMENT','1')
(C_VARIABLE,C_VALUE)#('STRUPLOADURL','')
[END] [DROP] UPSIZE
CONFIG_EXTENSION
[END] [CREATE] UPSIZE
ID
UPLOAD_VAR#VARCHAR (20)#NULL#
UPLOAD_VALUE#Int#NULL
[END] [CREATE] CONFIG_EXTENSION
ID
EXTENSION#VARCHAR (15)#NULL#
[END] [INSERT] UPSIZE
(UPLOAD_VAR,UPLOAD_VALUE)#('STRTIMEOUT','3600')
(UPLOAD_VAR,UPLOAD_VALUE)#('STRUPLOADFILESIZE','100000')
[END]

[edit 17.2.] FIXED

Have Fun!<
Looking for german Snitz forum? Suchst Du ein deutsches Snitz Forum? Hier findest Du eins...
Hosting with ASP Support available: http://www.sharepointing.com
Postet den
Advanced Member
Carefree
Innlegg: 4224
4224
Strictly in the interests of accuracy (since KB/MB/GB are really in multiples of 1024 vs 1000), lines 90-96 of "pop_upload_new.asp" should be changed as follows:
Code:

	If strAllowedSize < 1024 Then
strAllowedSize = Round(strAllowedSize,2) & " Bytes"
ElseIf strAllowedSize < 1048576 Then
strAllowedSize = Round(strAllowedSize/1024,2) & " KB"
Else
strAllowedSize = Round(strAllowedSize/1048576,2) & " MB"
End If
<
Postet den
Junior Member
vmplanet
Innlegg: 112
112
Question:

I read in your readme to make a dit in my forum dir. Problem i have is that my windows server is small. But i have a linux server with lot of space and datatraffic. I would like to set a folder on that server so not in the forum dir itself but on a totally different domain and server.
Is this possible?<
Postet den
Development Team Leader
Classicmotorcycling
Innlegg: 2085
2085
No it is not possible.
Originally posted by vmplanet
I would like to set a folder on that server so not in the forum dir itself but on a totally different domain and server.
Is this possible?
The upload takes advantage of some of the windoze scripting and writes it to your hard drive. Linux doesn't support the type of Scripting that this mod requires/needs to operate. shock<
Cheers,

David Greening
Du må legge inn en melding