Proeders file attachment - different upload sizes - Postet den (1222 Views)
Average Member
Webbo
Innlegg: 982
982
Has anyone had a go at setting different upload size limits for different user levels?
ie if mLev = 1 then allow such and such a size

and if mLev =>2 then allow a different size

? <
   
 Sidestørrelse 
Postet den
Advanced Member
Carefree
Innlegg: 4224
4224
No, but shouldn't be too difficult. Which program are you using to upload?
Assuming you want the file sizes to be in number of bytes, you could use a routine as below. You would only need two lines of type. Set your starting variable value (number of MB desired * 1024) - example is for 2 MB.

Then choose whether you want each user level's ratio to the starting variable to be a constant (as in the middle line), or to increase by a bigger percentage for each level (as in the final line - which squares the mLev before multiplying it by 2 MB.
Code:

'	######### Size Allowances Per MLev ########

' Starting value of 2 MB
intLvl=2048

' Max size would be 8 MB
allowedsize=intLvl*mLev

' Max size would be 32 MB
allowedsize=intLvl*(mLev^2)

' ######### Size Allowances Per MLev ########
<
Postet den
Average Member
Webbo
Innlegg: 982
982
I'm using 'proeder's file attachment V1.2'

The part that checks the file sizes is:

Code:
  '##### check max file size

strSQL = "SELECT UPLOAD_VALUE FROM " & strTablePrefix & "UPSIZE WHERE UPLOAD_VAR = 'STRUPLOADFILESIZE'"
set rsSize = my_Conn.Execute (strSQL)
strAllowedSize = rsSize("UPLOAD_VALUE")

if bytecount < strAllowedSize then
AllowSize = true
else
AllowSize = false
end if

rsSize.close
set rsSize = nothing

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

and I'd be looking to either use the sLev = from the sponsors mod but would have to add in some code to the inc_header_short.asp file so that sLev is recognised, or maybe looking at allowing increased upload limits for certain groups from the Usergroups mod<
 
Du må legge inn en melding