Author |
Topic |
|
rlangston
Starting Member
United Kingdom
4 Posts |
Posted - 06 April 2005 : 09:00:41
|
Functionality This mod allows administrators to upload files into the forum database, and restrict access to these files based on existing forum access rights.
It is intended to allow distribution of (small-ish) files to certains classes of forum user.
New pages are available to upload files and view a list of files currently in the database.
A link is provided in posts to download.asp?fileid=xx, which link can copied from the list of files.
download.asp tests access rights against forum access rights and prompts for a password if necessary.
Installation Copy the files in the zip to the forum folder:
dbs_securefiles.asp download.asp admin_files.asp admin_files_delete.asp admin_files_processupload.asp admin_files_upload.asp
To add the new options to admin_home.asp, between the lines
" <LI><span class=""spnMessageText""><a href=""admin_config_groupcats.asp"">Group Categories Configuration</a></span></LI>" & vbNewLine & _ and " </UL></p>" & vbNewLine & _
insert " <LI><span class=""spnMessageText""><a href=""admin_files.asp"">View file list</a></span></LI>" & vbNewLine & _ " <LI><span class=""spnMessageText""><a href=""admin_files_upload.asp"">Upload a file</a></span></LI>" & vbNewLine & _
You will also need to change the connection string settings in admin_files_processupload.asp as config.asp is not #included. The following lines are therefore in admin_files_processupload.asp:
strConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\domains\taxresource.co.uk\db\forum.mdb" '## MS Access 2000 strTablePrefix = "FORUM_"
(config.asp cannot be included because the upload script needs to do a binary read to get the file)
Download Download from http://www.zen41739.zen.co.uk/code/SecureFileUpload.zip |
Edited by - rlangston on 06 April 2005 11:14:47 |
|
OneWayMule
Dev. Team Member & Support Moderator
Austria
4969 Posts |
|
rlangston
Starting Member
United Kingdom
4 Posts |
Posted - 06 April 2005 : 11:15:18
|
Download should work now - problem with caps in the filename! |
|
|
Classicmotorcycling
Development Team Leader
Australia
2084 Posts |
Posted - 06 April 2005 : 18:33:20
|
I noticed it stated:quote: (config.asp cannot be included because the upload script needs to do a binary read to get the file)
Does this mean that it it puts the file you want to share in the DB? If it does then the DB will fill up rather quickly and force your forum to run slower. Maybe it would be better if there was a sperate DB that the files could be sent to rather than the forum's DB if a DB needs to be used to store the files! Just a bit of food for thought.
By the way download works and an interesting idea of a MOD you have created.
|
Cheers, David Greening |
|
|
cyber Knight
Starting Member
41 Posts |
Posted - 07 April 2005 : 09:30:35
|
Perfect just what i've been looking for. Thank you very much rlangston
sorry for posting off topic .i need help adding a button or link to private messages only Admins\Moderators can see.
Thank you.
|
|
|
rlangston
Starting Member
United Kingdom
4 Posts |
Posted - 08 April 2005 : 17:25:18
|
The uploaded files are stored in the forum database - but it would not be too difficult to modify the code to store them in a second database.
Sample code at http://www.zen41739.zen.co.uk/code/SecureFileUploadA.zip
You will need also to
- create a database with the correct fields (per the original dbs file) - add the lines above to admin_home.asp - add the new connection string to config.asp eg
strConnFilesString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\wwwroot\taxresource2\db\forumfiles.mdb" '## MS Access 2000
The original purpose was to allow the upload of small files, which would hopefully not impinge too much on the database speed. However, if larger files were uploaded, a separate database could become more beneficial - although ease of installation suffers.
If the mod is extended to allow file upload by all users, this issue may become even more important. |
|
|
tribaliztic
Senior Member
Sweden
1532 Posts |
Posted - 11 April 2005 : 04:48:34
|
Is it possible to upload/share ALL filetypes? Is there a limit in filesize?
|
/Tribaliztic - www.gotlandrace.se -
|
|
|
rlangston
Starting Member
United Kingdom
4 Posts |
Posted - 11 April 2005 : 14:57:10
|
Currently all file sizes and types are allowed. It should be quite easy to restrict this, however.
In admin_processupload.asp, after the line
forumid=objUpload.Form.Item("forumid")
add something like
if objUpload.Files.Item(0).Length > 100000 then response.end() end if
if instr("application/vnd.ms-excel application/msword", objUpload.Files.Item(0).ContentType) = 0 then response.end() end if
The first if statement checks for the filesize, and the second for content-type (only allowing word and excel docs in the example).
I have noticed a mistake in admin_processupload.asp. Line 110 should read
Length = m_Length
rather than
Name = m_Length
The zip file has been updated for this change. |
|
|
|
Topic |
|