Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Upload Quota for Proeder's Attachment Mod
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

PPSSWeb
Junior Member

312 Posts

Posted - 19 February 2007 :  14:16:57  Show Profile  Reply with Quote
I am working on a mod to provide upload quota's per user for Proeder's attachment mod. If I didn't forget anything the following should allow you to set a quota. Here goes...

In <b>Config.asp</b> look for "Dim strUploadUrl, strAllowAttachment". After that line insert the following:

const maxDiskSpace = <font color="red"><Integer value for maximum upload in bytes></font id="red"> 'Define Maximum Disk Space for uploads Per User


In <b>myfiles.asp</b> look for "if FSO.FolderExists(Path) then" approx line #227. After that line insert the following:

'#################display current disk usage################   
   Dim ds 
   Set ds = FSO.GetFolder(Path) 
   Response.Write "<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize-2 & """><b>Current Disk Usage = " & Round(ds.Size/1048576,2) & " MB" 
    IF AdminAllowed=false then 
     Response.Write  " of "& maxDiskSpace/1048576 & " MB</b></font></p><p>"
    Else
     Response.Write  "</b></font></p><p>"
   End IF
   set ds=nothing   
'###########################################################


Approximately line 252 find the associated "else" After that line insert the following:

'#################display current disk usage################     
    Response.Write "<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize-2 & """><b>Current Disk Usage = 0 MB" 
    IF AdminAllowed=false then 
     Response.Write  " of "& maxDiskSpace/1048576 & " MB</b></font></p><p>"
    Else
     Response.Write  "</b></font></p><p>" 
    End IF  
'###########################################################


In <b>ouputFile.asp</b> look for "Create and Write to a File" approx line #162. Before that line insert:

'##################limit uploads directory size to less than maxDiskSpace#####################
Dim ds 
Set ds=ScriptObject.GetFolder(memberPath)
IF ds.Size + bytecount > maxDiskSpace then
 Response.Write "<html>" & vbNewline
 Response.Write "<head>" & vbNewline
 Response.Write "<title>Error while uploading</title>" & vbNewline
 Response.Write "</head>" & vbNewline
 Response.Write "<body link=""" & strLinkColor & """ aLink=""" & strActiveLinkColor & """ vLink=""" & strActiveLinkColor & """>" & vbNewline
 Response.Write "<p align=""center"">" & vbNewline
 Response.Write " <font face=""" & strDefaultFontFace & """ size=""" & strHeadFontSize & """ color=""" & strDefaultFontColor & """><b><br>This file cannot be uploaded.<br><br></b></font></ br><hr size=""1"" color=""" & strHiLiteFontColor & """>" & vbNewline
 Response.Write " <table>" & vbNewline
 Response.Write "  <tr><td><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """><b> Maximum Disk Space </b></font></td><td><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """>- Maximum upload disk space of " & maxDiskSpace/1048576 & " MB exceeded. " & vbNewLine & "Current Disk Usage =  " & Round(ds.Size/1048576,2) & " MB</font></td></tr>" & vbNewline
 Response.Write " </table><hr size=""1"" color=""" & strHiLiteFontColor & """>" & vbNewline
 Response.Write " <p align=""center""><a href=""#"" onClick=""history.go(-1);"" style=""text-decoration: none""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """>Please click here to go back and choose another file to upload.</font></a></p>" & vbNewline
 Response.Write "</p>" & vbNewline
 Response.Write "</body>" & vbNewline
 Response.Write "</html>" & vbNewline
Else 
'#############################################################################################


Approximately line #224 locate the "Else". Just before it insert:

'#########close limit for maxDiskSpace##### 
 End If 
 set ds=nothing
'##########################################


<font size="1">Thanks go to Desmomax who provided the idea for the mod in the first place. </font id="size1">

Edited by - PPSSWeb on 20 February 2007 09:17:25
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000 Version 3.4.07