File Manager?

Snitz™ Forums 2000
https://forum.snitz.com/forumTopic/Posts/63116?pagenum=1
04 November 2025, 22:10

Topic


Desmomax
File Manager?
27 October 2006, 03:46


Hallo !
I am looking for a MOD that allow user to menage their files uploaded in posts (delete, use again in other posts..) and allow me to give a kb limit of files uploaded. At moment the only way is to check the directory named for each user

Can someone suggest me a Mod ?
many thanx
<

 

Replies ...


weeweeslap
27 October 2006, 03:56


http://www.snitzbitz.com/mods/default.asp?pg=4&SortBy=Name&SortDir=asc&Version=All
couple file stuff there, file library might be the one you want<
modifichicci
27 October 2006, 13:50


Proeder file attach mod, on snitzbitz.<
Desmomax
31 October 2006, 03:04


thanks all..
grazie modifichicci wink<
Desmomax
13 February 2007, 10:59


I installed this mod. I can decide the maximun file size but i can not find where to set the maximun disk space allowed.
is it possible? i'd like to give a limited space where upload files for each user. many thanx
<
Shaggy
13 February 2007, 11:08


As far as I know, none of the attachment or file manager files include such a feature; you would need to edit your files to include a check on the size of the folder before processing the upload.
<
Desmomax
13 February 2007, 12:47


unfortunally i cant do that..
i dont know so well asp
<
Shaggy
13 February 2007, 12:58


Which mod are you using?
<
PPSSWeb
13 February 2007, 13:57


If you are using Proeder's as suggested above you can modify the code in outputFile.asp to limit by folder size by adding the following:

around line#161 after the endif and before 'Create and Write to a File insert:
Code:
'##################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
'#############################################################################################

around line#224 between the Response.Write and the Else insert:
Code:
'#########close limit for maxDiskSpace#####	
End If
set ds=nothing
'##########################################

Then add the constant maxDiskSpace to your config.asp file in the variable section:
Code:
'###################Define Maximum Disk Space for uploads Per User##############
Const maxDiskSpace = 1048576
'###############################################################################
<
PPSSWeb
13 February 2007, 15:21


You might also want to let the users know how much disk space they have used of their quota in the myfiles page.
Insert at line#222 the following:
Code:
'#################display current disk usage################
Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
Dim ds
Set ds=ScriptObject.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
'###########################################################
<
Desmomax
14 February 2007, 03:13


great!!!! many thanks!!
unfortunally i can not find the line where insert your code. My outputfile.asp is totally different... i have the lcamara's mod of proeder mod (with fixes from modifichicchi and others). Here is mine outputfile, could you please give it a look and tell me where insert your code? many thanx

Download Outputfile.rar <
thermal_seeker
14 February 2007, 08:56


is it possible to allow different members different amounts of disk space??
Dave<
PPSSWeb
14 February 2007, 09:38


Originally posted by thermal_seeker
is it possible to allow different members different amounts of disk space??

Yes, you could add more variables for the different member levels, etc. Then change the if statement to check for the different members and use their associated quota's.
I never thought to do this until Desmomax mentioned it. It was a great idea so I put this code on my intranet site. I have one user who requires more disk space than others, so I changed the const maxDiskSpace to a variable in config.asp and added an if statement to check for her usergroup (usergroups mod saves the day again) and change the value before the check against the bytecount.<
thermal_seeker
14 February 2007, 13:03


would you like to share your piece of code??
would I have to make extra usergroups (ie file upload, file upload2, file upload3 etc?)

EDIT: thinking about this a bit more.. I have set the max upload size to 20MB. Once a user gets to that amount surely all I would have to do is allow them to usergroup fileupload2 for a further 20MB?? and so on...or am I missing something?? I presume that I would also have to add another line to post.asp
Code:
if ((mlev > 3) or InArray(strGroupMembership, intFileUpload2Allowed)) then ' check that user is either administrator of member of upload2 usergroup
and in config.asp
Code:
const intFileUpload2Allowed = <integer value of group>



Dave<
Desmomax
15 February 2007, 02:59


Originally posted by PPSSWeb I never thought to do this until Desmomax mentioned it. It was a great idea so I put this code on my intranet site.

Many thanx for your help
glad to have given my contribution even if only with an idea<
Desmomax
15 February 2007, 04:53


it works!!! Great!!! :)

i have only a little error:

when i try to upload a file too big then i receive the error message , when i click to COME BACK on the pop up windows i receive this error:

Errore di run-time di Microsoft VBScript error '800a0005'

Chiamata di routine o argomento non validi: 'MidB'

/myforum/upload.asp, line 5


The line is:
boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)


any idea?
<
Desmomax
15 February 2007, 11:21


I'd like to do not set a limit for my moderators. How can i change the code to do this? i tried to change :
IF ds.Size + bytecount > maxDiskSpace then

in

IF ds.Size + bytecount > maxDiskSpace and mlev <2 then

but doesnt work...
<
Desmomax
16 February 2007, 05:00


Originally posted by PPSSWeb
You might also want to let the users know how much disk space they have used of their quota in the myfiles page.
Insert at line#222 the following:
Code:
'#################display current disk usage################
Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
Dim ds
Set ds=ScriptObject.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
'###########################################################

Hallo,

i tried to test the code with a username i created.
This directory doesnt exist in upload folder (No files uploaded by this user) then if i click on MY FILES i receive the following error:

Files nella tua directory di upload...
Errore di run-time di Microsoft VBScript error '800a004c'

Impossibile trovare il percorso (path not found)

/myforum/myfiles.asp, line 225


Line 225 is the one you suggest me:
Set ds=ScriptObject.GetFolder(Path)

Do you know how to fix it?
many thanx

<
PPSSWeb
16 February 2007, 11:22


Originally posted by thermal_seeker
would you like to share your piece of code??
would I have to make extra usergroups (ie file upload, file upload2, file upload3 etc?)

EDIT: thinking about this a bit more.. I have set the max upload size to 20MB. Once a user gets to that amount surely all I would have to do is allow them to usergroup fileupload2 for a further 20MB?? and so on...or am I missing something?? I presume that I would also have to add another line to post.asp
Code:
if ((mlev > 3) or InArray(strGroupMembership, intFileUpload2Allowed)) then ' check that user is either administrator of member of upload2 usergroup
and in config.asp
Code:
const intFileUpload2Allowed = <integer value of group>



Dave


thermal_seeker,

Sorry for the delayed response. We have not had power for days here.
Still working the bugs out of getting it to work with usergroups (myfiles works fine, outputFile does not yet). I will post the solutions when/IF I get it working.

<
PPSSWeb
16 February 2007, 11:24


Originally posted by Desmomax
it works!!! Great!!! :)

i have only a little error:

when i try to upload a file too big then i receive the error message , when i click to COME BACK on the pop up windows i receive this error:

Errore di run-time di Microsoft VBScript error '800a0005'

Chiamata di routine o argomento non validi: 'MidB'

/myforum/upload.asp, line 5


The line is:
boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)


any idea?


I have seen this before, but not consistently. If I refresh the page the error is usually gone. I have never had a user encounter it either, so I am not sure the cause. Does it happen consistently and is repreducable for you?<
PPSSWeb
16 February 2007, 11:31


Originally posted by PPSSWeb
You might also want to let the users know how much disk space they have used of their quota in the myfiles page.
Insert at line#222 the following:
Code:
'#################display current disk usage################
Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")
Dim ds
Set ds=ScriptObject.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
'###########################################################

Hallo,

i tried to test the code with a username i created.
This directory doesnt exist in upload folder (No files uploaded by this user) then if i click on MY FILES i receive the following error:

Files nella tua directory di upload...
Errore di run-time di Microsoft VBScript error '800a004c'

Impossibile trovare il percorso (path not found)

/myforum/myfiles.asp, line 225


Line 225 is the one you suggest me:
Set ds=ScriptObject.GetFolder(Path)

Do you know how to fix it?
many thanx



Right,

Good catch, we need to check that the folder exists before we start getting the details from it. change that piece of code to the following.

Try putting this:
Code:
IF ScriptObject.FolderExists(Path) THEN
before the dim ds and close the if by putting
Code:
End IF
after the set ds=nothing
Let me know if that clears it up. If so we should rework it so it fits into the IF statement below which performs the same check.<
PPSSWeb
16 February 2007, 14:37


Desmomax
19 February 2007, 04:15


Originally posted by PPSSWeb Right,

Good catch, we need to check that the folder exists before we start getting the details from it. change that piece of code to the following.

Try putting this:
Code:
IF ScriptObject.FolderExists(Path) THEN
before the dim ds and close the if by putting
Code:
End IF
after the set ds=nothing
Let me know if that clears it up. If so we should rework it so it fits into the IF statement below which performs the same check.

Many thanx!!! now it works!! coolcool<
PPSSWeb
19 February 2007, 09:19


Originally posted by Desmomax
Many thanx!!! now it works!! coolcool

Did you try the most recent version of the code? I would like to have someone test it to make sure I didn't forget anything.

Thanks,
Steve<
Desmomax
19 February 2007, 10:40


Right,

Good catch, we need to check that the folder exists before we start getting the details from it. change that piece of code to the following.
Try putting this:

IF ScriptObject.FolderExists(Path) THEN


before the dim ds
and close the if by putting

End IF


after the set ds=nothing

Let me know if that clears it up. If so we should rework it so it fits into the IF statement below which performs the same check.
<
Desmomax
20 February 2007, 05:37


Thanks PPSSWeb but i dont have usergroup mod installed and i am not interested..
is it possibile to do not check the space used only by MODERATORS and ADMIN ?
how i have to modify your code to do this? many thanx
<
PPSSWeb
20 February 2007, 10:42


Originally posted by Desmomax
is it possibile to do not check the space used only by MODERATORS and ADMIN ?
how i have to modify your code to do this? many thanx


I am not sure I understand correctly, but I think you are asking to perform quota check on normal members only and not admins or moderators.

To do so, you would have to check their member level and only run the quota check if mlev > 2.

First you would have to get mlev over to the right spot to check it.

In pop_upload_new.asp change line #119 to:
Code:
Response.Write	"	 <input type=""hidden"" name=""memberName"" value=""" & strDBNTUserName & """><input type=""hidden"" name=""memberID"" value=""" & MemberID & """><input type=""hidden"" name=""mLev"" value=""" & mLev & """>" & vbNewline & _

Then use it in outputFile.asp to check about using the quota.
At line#75 insert:
Code:
mLev = UploadRequest.Item("mLev").Item("Value")

Then before the "Dim ds" insert:
Code:
IF (mLev < 3)

and after the "set ds=nothing" insert:
Code:
End If

Also, you may want to do the same in myfiles.asp to have it not display a limit there. <
Desmomax
20 February 2007, 13:16


yes, you are right... i'd like to perform quota check only on normal users.
I tried to insert the code you suggest but something is wrong.. i am not sure about the right position for the code in outputfile.asp as i have at line 75 comments lines.
Here is mine outputfile.asp , could you please take a look?
Download Outputfile

after that, sure, i need to change also myfiles.asp...
really appreciate your help
<
PPSSWeb
20 February 2007, 15:08


Originally posted by Desmomax

after that, sure, i need to change also myfiles.asp...
really appreciate your help


Yep, just do the same. Wrap the code for the quotas in the same "IF - End If". I am not sure which version you have running from the above, I can't tell you exactly where to put.<
Desmomax
21 February 2007, 18:04


I followed your instructions but after that if i try to upload a file after selected the file i receive a blank window and nothing come...
here is how i changed my outputfile.asp and pop_upload_new.aso, could you take a look?
Download file RAR of my asp
many thanx

<
PPSSWeb
22 February 2007, 09:12


Your pop_upload_new.asp looks good, so it should be passing the mLev over to outputFile.asp

Check that your mLev is getting to the outputFile.asp correctly. Insert Response.Write "Member level: " & mLev & vbNewLine

into the code before the test for mLev<3 to make sure it has the correct value.<
Desmomax
23 February 2007, 02:58


I'll try. Anyway something is wrong.. after i uploaded the file instead of confirmation i receive a blank window
10x
<
Desmomax
26 February 2007, 05:36


Originally posted by PPSSWeb
Your pop_upload_new.asp looks good, so it should be passing the mLev over to outputFile.asp

Check that your mLev is getting to the outputFile.asp correctly. Insert Response.Write "Member level: " & mLev & vbNewLine

into the code before the test for mLev<3 to make sure it has the correct value.

I tried to insert the Response.Write for Mlev and i obtain a correct value of "4" (logged as admin) but after that the windows is blank, i receive no confirmation that the file is uploaded..

here is what i obtain:



Can you help me? i receive no Error then i dont know where to check...
thanx
<
PPSSWeb
26 February 2007, 09:48


Ok, problem is in placement of the check for Mlev.
Remove your:
If mLev<3 Then and the corresponeding End If (lines 260 and 336)

Then combine the mLev check with the other condition statement to make:
Code:
IF (mLev < 3) and ds.Size + bytecount > maxDiskSpace then
for line #263.
That should fix it.<
Desmomax
26 February 2007, 11:18


many thanx

it works!! :)

i have just a little problem.. if i try to upload a bigger file i receive this error (after the correct window with the advise that the file is too big):

Errore di run-time di Microsoft VBScript error '800a0005'

Chiamata di routine o argomento non validi: 'MidB'

/myforum/upload.asp, line 5


Line 5 is this:
boundary = MidB(RequestBin,PosBeg,PosEnd-PosBeg)


Do you have any idea? :)
<
PPSSWeb
26 February 2007, 11:36


Not sure, as search has turned up a lot of instances of this error. Are you trying to upload an allowed extension type?<
Desmomax
27 February 2007, 03:23


Originally posted by PPSSWeb
Not sure, as search has turned up a lot of instances of this error. Are you trying to upload an allowed extension type?

The error comes if i try to upload an extension not allowed, or a file too big... i see the correct window with the error message " file not allowed... or... file too big.. etc" then when i click to "back to forum" the error comes.. any idea? <
PPSSWeb
27 February 2007, 10:24


Originally posted by Desmomax
The error comes if i try to upload an extension not allowed, or a file too big... i see the correct window with the error message " file not allowed... or... file too big.. etc" then when i click to "back to forum" the error comes.. any idea?

Got it, I was not able to reproduce this in IE, which is what we use here unfortunately, but I was able to reproduce it in FireFox. The problem is the onClick=""history.go(-1);"" part of that link which takes you back into upload.asp code instead of pop_upload_new.asp code in non-IE browsers, or at least in firefox. Solution, change the link.

From:
Code:
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

To:
Code:
Response.Write	"	<p align=""center""><a href=""./pop_upload_new.asp"" 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

This should force the browser to go back to the pop_upload_new page. <
Desmomax
01 March 2007, 04:28


thanx, i'll try it but i got the error with Mozilla FireFox 2.0 ( i use only this browser). <
Desmomax
01 March 2007, 04:33


i tried to modify as you suggest, but i still receive the error on line 5 of upload.asp :(
<
PPSSWeb
01 March 2007, 08:35


Originally posted by Desmomax
i tried to modify as you suggest, but i still receive the error on line 5 of upload.asp :(

Did you force a reload on the upload pages and clear your cache after changing the link?<
Desmomax
02 March 2007, 08:58


Originally posted by Desmomax
i tried to modify as you suggest, but i still receive the error on line 5 of upload.asp :(

Did you force a reload on the upload pages and clear your cache after changing the link?
Yes, i tried but still the same error... sad<
Desmomax
02 March 2007, 10:41


May i ask you something more? :)

now, with your fix, my >3 level users (moderators, admin) dont have a limit in their upload folder... is it possibile to do not apply as well the max file size limit set with this mod ?
thanks
<
PPSSWeb
02 March 2007, 11:19


I don't see why you couldn't. You should have everything in place to do that already now. You should just have to wrap the check max file size code in pop_upload_new and outputfile in a similar check (if mLev<3).<
Desmomax
04 March 2007, 16:44


Originally posted by PPSSWeb
I don't see why you couldn't. You should have everything in place to do that already now. You should just have to wrap the check max file size code in pop_upload_new and outputfile in a similar check (if mLev<3).

thanks, but i am not sure to know where exact insert the code in pop_upload_new and outputfile...dead<
PPSSWeb
05 March 2007, 09:03


I believe the code is the same in both files. Look for:
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 change it to:
Code:
	strAllowedSize = "Not Restricted"
AllowSize = True
'##### check max file size if mLev<3 only
IF (mLev<3)
if
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
End If

I don't have a chance to test this myself right now, but I believe this will do what you want. Try it out and let me know.<
Desmomax
09 March 2007, 06:11


many thanx! it works.. now the FILE MANAGER IMHO is absolutely complete! this should be inserted in a origninal mod or a new one.. <
bobby131313
08 May 2020, 21:13


Originally posted by Desmomax
unfortunally i cant do that..
i dont know so well asp
<
HuwR
10 May 2020, 08:30


Is there any reason you made that post @bobby131313
bobby131313
23 May 2020, 15:37


Sorry Huw, it was an accident, a google search took me straight to post.asp on the old site with this already filled in. I somehow accidentally posted it.
HuwR
25 May 2020, 08:44


Sorry Huw, it was an accident, a google search took me straight to post.asp on the old site with this already filled in. I somehow accidentally posted it.Originally posted by bobby131313
No prob smile
© 2000-2021 Snitz™ Communications