Author |
Topic |
jkmcgrath
Junior Member
USA
145 Posts |
Posted - 08 January 2003 : 17:54:45
|
Mine wouldnt work with that block of code. It had to have the extra end it. I guess it is from another mod I have installed. |
Delta Force Seals |
|
|
James
Average Member
USA
539 Posts |
Posted - 08 January 2003 : 21:28:16
|
quote: Originally posted by jkmcgrath
Mine wouldnt work with that block of code. It had to have the extra end it. I guess it is from another mod I have installed.
Probably.
Anyway, you might want to change the block of code added to that file to include the check for registering so that the view files button doesn't show up when a new user is registering. |
*Interested in Radio Control* *The RC Web Board - http://www.rcwebboard.com/* |
|
|
suhern
Junior Member
186 Posts |
Posted - 15 January 2003 : 05:09:50
|
I don't know whether this has been done but this will give your members the ability to delete files that they have uploaded. Yes it will be wiped out from the folder (FSO is required). Make the following changes in red in your myfiles.asp:
<% Server.ScriptTimeout = 5000 %> <!--#INCLUDE FILE="config.asp" --> <!--#INCLUDE FILE="inc_func_common.asp" --> <!--#INCLUDE FILE="inc_func_member.asp" --> <% Dim Path, Fso, SubFolderName, UploadFolder, MyDomianName, UseFile, AdminAllowed, Extension Dim Name, FileName, IconImage
UseFile = "" UseFile = CStr(Request("InsertFile"))
' ##### add this line ##### DeleteFunc = CStr(Request("DeleteFile"))
' ##### modify this line ##### if UseFile = "select" or UseFile = "true" or DeleteFunc = "true" then %><!--#INCLUDE FILE="inc_header_short.asp" --><% else %><!--#INCLUDE FILE="inc_header.asp" --><% end if
if strDBNTUserName = "" then Err_Msg = "<li>You must be logged in to view the Members List</li>" Response.Write " <table width=""100%"" border=""0"">" & vbNewLine & _ " <tr>" & vbNewLine & _ " <td><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _ " " & getCurrentIcon(strIconFolderOpen,"","") & " <a href=""default.asp"">All Forums</a><br />" & vbNewLine & _ " " & getCurrentIcon(strIconBar,"","") & getCurrentIcon(strIconFolderOpenTopic,"","") & " Uploaded Files</font></td>" & vbNewLine & _ " </tr>" & vbNewLine & _ " </table>" & vbNewLine & _ " <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """ color=""" & strHiLiteFontColor & """>There Was A Problem!</font></p>" & vbNewLine & _ " <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHiLiteFontColor & """>You must be logged in to view this page</font></p>" & vbNewLine & _ " <p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""default.asp"">Back to Forum</a></font></p>" WriteFooter response.end else
AdminAllowed = 0 SubFolderName = ""
MyDomainName = "www.yourdomain.com"'## Use your domain name UploadFolder = "/yourpath/folder" '## Use path to your upload directory from root iconimage = "/home/icon_paperclip.gif" '## Use path to your forum images from root
if (mLev = 4) then AdminAllowed = 1 end if
' ##### modify this line ##### if UseFile <> "select" and UseFile <> "true" or DeleteFunc <> "true" then Response.Write " <table width=""100%"" border=""0"">" & vbNewLine & _ " <tr>" & vbNewLine & _ " <td><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _ " " & getCurrentIcon(strIconFolderOpen,"","") & " <a href=""default.asp"">All Forums</a><br />" & vbNewLine & _ " " & getCurrentIcon(strIconBar,"","") & getCurrentIcon(strIconFolderOpenTopic,"","") & " Uploaded Files</font></td>" & vbNewLine & _ " </tr>" & vbNewLine & _ " </table>" end if
' ##### add these lines ##### if DeleteFunc = "true" then
Dim FileNamePath Name = "" Name = CStr(Request("FileToInsert")) FileName = LCase(Mid(Name,InStrRev(Name,"."))) if AdminAllowed then FileNamePath = "d:\websites\xxxx\www\xxxx\xxxx\" & Name ' physical path to your folder, someone can make this dynamic else FileNamePath = "d:\websites\xxxx\www\xxxx\xxxx\" & strDBNTUserName & "\" & Name ' physical path to your folder, someone can make this dynamic end if
Dim objFSO Set objFSO = Server.CreateObject("Scripting.FileSystemObject") objFSO.DeleteFile FileNamePath, false Set objFSO = Nothing
Response.Write "<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """><b>File deleted.</b></font></p>" response.write "<p align=""center""><a href=""#"" onClick=""window.close();"">Please click here to close this window.</a></p>" response.end End if
if UseFile = "true" then 'Dim FileNamePath Name = "" Name = CStr(Request("FileToInsert")) FileName = LCase(Mid(Name,InStrRev(Name,"."))) if AdminAllowed then FileNamePath = "http://" & MyDomainName & UploadFolder & Name else FileNamePath = "http://" & MyDomainName & UploadFolder & "/" & strDBNTUserName & "/" & Name end if select case FileName case ".jpg", ".jpeg", ".gif", ".png" %> <script> opener.document.PostTopic.Message.value+="\n\nImage Insert:
"; </script> <% case else %> <script> opener.document.PostTopic.Message.value+="\n\nDownload Attachment: [url=\"<% =FileNamePath %>\"] <% =Name %>[/url] "; </script> <% end select Response.Write "<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """><b>File inserted into your post.</b></font></p>" response.write "<p align=""center""><a href=""#"" onClick=""window.close();"">Please click here to close this window.</a></p>" response.end end if
if AdminAllowed then Response.Write "<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """><b>Files in the upload directories...</b></font></p>" Path = server.mappath(UploadFolder & "/") Response.Write("Using path: http://" & MyDomainName & UploadFolder & "<p>") else Response.Write "<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strHeaderFontSize & """><b>Files in your upload directory...</b></font></p>" Path = server.mappath(UploadFolder & "/" & strDBNTUserName & "/") Response.Write("Using path: http://" & MyDomainName & UploadFolder & "/" & strDBNTUserName & "/<p>") end if
Dim fs, f, folder, fc, s Set Fso = CreateObject("Scripting.FileSystemObject")
if FSO.FolderExists(Path) then response.write "<table width=""100%"" border=""1""><font size = 1 face=""arial, helvetica, sans-serif"">" Call ScanFolders(Path) response.write "</font></table>" else response.write "There are no files in your directory..." end if
if UseFile <> "select" then Response.Write "<p align=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """><a href=""default.asp"">Back To Forum</a></font></p>" & vbNewLine end if
end if
Function ScanFolders(PathSpec) Dim fs, f, Folder, fc, s, File, FileList, FolderInfo, FileName, Name response.write "<BLOCKQUOTE>" Set FolderInfo = Fso.GetFolder(PathSpec) Set FileList = FolderInfo.Files For Each File in FileList Name = Cstr(File.Name) FileName = UCase(Mid(Name,InStrRev(Name,"."))) response.write "<tr>" if AdminAllowed then Name = SubFolderName & "/" & Name end if If UseFile = "select" then response.write " <td>" & vbNewline & _ " <INPUT TYPE=""submit"" NAME=""enter"" value=""Insert"" onclick=""JavaScript:window.location=('myfiles.asp?InsertFile=true&FileToInsert=" & Name & "');"">" & vbNewline & _ " <br></td>" response.write " <td>" & vbNewline & _ " <INPUT TYPE=""submit"" NAME=""enter"" value=""delete"" onclick=""JavaScript:window.location=('myfiles.asp?DeleteFile=true&FileToInsert=" & Name & "');"">" & vbNewline & _ " <br></td>" end if response.write "<td width=""70%"">" select case FileName case ".HTM", ".HTML" Response.Write("<Font color =Teal>" & Name & "<br></font>") case ".JPG", ".JPEG", ".GIF", ".PNG" if AdminAllowed then Response.Write("<Font color =Red>" & Name & "<br></font>") if UseFile <> "select" then response.write("</td><td><a href= """ & UploadFolder & Name & """>View Image</a><br>") end if else Response.Write("<Font color =Red>" & Name & " </font>") if UseFile = "select" then response.write("</td><td><img src=""" & UploadFolder & "/" & strDBNTUserName & "/" & Name & """ alt=""http://" & MyDomainName & UploadFolder & "/" & strDBNTUserName & "/" & Name & """ height=""100"" width=""100""><br>") else response.write("</td><td><a href= """ & UploadFolder & "/" & strDBNTUserName & "/" & Name & """><img src=""" & UploadFolder & "/" & strDBNTUserName & "/" & Name & """ alt=""http://" & MyDomainName & UploadFolder & "/" & strDBNTUserName & "/" & Name & """ height=""100"" width=""100""></a><br>") end if end if case ".DOC" Response.Write("<Font color =Blue>" & Name & "<br></font>") case ".TXT" if AdminAllowed then Response.Write("<Font color =Green>" & Name & "<br></font>") if UseFile <> "select" then response.write ("</td><td><a href= """ & UploadFolder & Name & """>View File</a>") end if else Response.Write("<Font color =Green>" & Name & "<br></font>") if UseFile <> "select" then response.write("</td><td><a href= """ & UploadFolder & "/" & strDBNTUserName & "/" & Name & """>View File</a><br>") end if end if case ".ZIP" Response.Write("<Font color =Silver>" & Name & "<br></font>") case ".PDF" Response.Write("<Font color =Fuscia>" & Name & "<br></font>") case ".WAV" Response.Write("<Font color =Olive>" & Name & "<br></font>") case else Response.Write("<Font color =Maroon>" & Name & "<br></font>") end select response.write "</td></tr>" Next
response.write "</BLOCKQUOTE>"
Set f = Fso.GetFolder(PathSpec) if AdminAllowed then Set fc = f.SubFolders For Each Folder in fc SubFolderName = "/" & Folder.Name if LCase(Mid(SubFolderName,1,5)) <> "/_vti" then '## Uncomment Above Line if you use Front Page and you don't want "_vti" directories to show response.write "<BLOCKQUOTE>" Call ScanFolders(PathSpec & "/" & Folder.Name) response.write "</BLOCKQUOTE>" end if '## Uncomment Above Line if you use Front Page and you don't want "_vti" directories to show Next end if
End Function
if UseFile = "select" then %><!--#INCLUDE FILE="inc_footer_short.asp" --><% else %><!--#INCLUDE FILE="inc_footer.asp" --><% end if %>
hope it works for you as it does for me, let me know... |
Edited by - suhern on 15 January 2003 05:14:29 |
|
|
homeacademy
Junior Member
USA
163 Posts |
Posted - 19 January 2003 : 08:13:38
|
suhern,
Thanks for a much awaited addition to this mod! Works great, on Netscape and IE! To make directory paths dynamic, replace this:
if AdminAllowed then
FileNamePath = "d:\websites\xxxx\www\xxxx\xxxx\" & Name ' physical path to your folder, someone can make this dynamic
else
FileNamePath = "d:\websites\xxxx\www\xxxx\xxxx\" & strDBNTUserName & "\" & Name ' physical path to your folder, someone can make this dynamic
end if
With this:
if AdminAllowed then
FileNamePath = server.mappath("uploads") & Name ' dynamic path to uploads folder.
else
FileNamePath = server.mappath("uploads") & "\" & strDBNTUserName & "\" & Name ' dynamic path to uploads folder
end if
Thanks again!
|
|
|
suhern
Junior Member
186 Posts |
Posted - 19 January 2003 : 09:07:44
|
quote: Originally posted by homeacademy
suhern,
Thanks for a much awaited addition to this mod! Works great, on Netscape and IE! To make directory paths dynamic, replace this:
if AdminAllowed then
FileNamePath = "d:\websites\xxxx\www\xxxx\xxxx\" & Name ' physical path to your folder, someone can make this dynamic
else
FileNamePath = "d:\websites\xxxx\www\xxxx\xxxx\" & strDBNTUserName & "\" & Name ' physical path to your folder, someone can make this dynamic
end if
With this:
if AdminAllowed then
FileNamePath = server.mappath("uploads") & Name ' dynamic path to uploads folder.
else
FileNamePath = server.mappath("uploads") & "\" & strDBNTUserName & "\" & Name ' dynamic path to uploads folder
end if
Thanks again!
Thanks. Works great. |
|
|
korayem
New Member
Egypt
72 Posts |
|
DJ5A
Junior Member
163 Posts |
Posted - 12 February 2003 : 12:38:29
|
Hello Everybody:
Is there plans in the future to Limit the Number of Files a Member can have in their folder? It looks like everything else is there!
Very Nice Mod! |
Thank You for Your Time!!!!! DJ5A |
Edited by - DJ5A on 12 February 2003 15:54:18 |
|
|
korayem
New Member
Egypt
72 Posts |
Posted - 16 February 2003 : 12:26:20
|
quote: Originally posted by DJ5A
Hello Everybody:
Is there plans in the future to Limit the Number of Files a Member can have in their folder? It looks like everything else is there!
Very Nice Mod!
good news DJ5A, its been done!!
again goto this topic: http://forum.snitz.com/forum/topic.asp?TOPIC_ID=30761&whichpage=8
and read my second post...enjoy.. |
By the time you read this, you've already read it!! http://HASdot.COM/
|
|
|
goldfish
New Member
82 Posts |
Posted - 04 March 2003 : 13:50:55
|
quote: Dim Path, Fso, SubFolderName, UploadFolder, MyDomianName, UseFile, AdminAllowed, Extension Dim Name, FileName, IconImage
myfiles.asp
That doesn't seem to break anything and I don't know why.... I just downloaded the latest version of the MOD and it's still in there as Domian so I figured I should let you know....
My problem
I've applied first Suhern, and then Homeacademy's changes, but I'm getting a problem in myfiles.asp as below...
quote: Microsoft VBScript compilation error '800a0411'
Name redefined
/rdonline/forum/myfiles.asp, line 99
Dim FileNamePath ----^
Anyone any idea what would be causing this....? I figure it's the dynamic filepath thingummy (FileNamePath = server.mappath("uploads") & Name)... should the 'uploads' bit incorporate the FULL filepath to the uploads directory, or is that nothing to do with it, and I've just stuffed something else up?
OK think I've sussed the above, there was a missing ' before Dim FileNamePath compared to Suhern's version roundabout line 95... so I get the file list up with delete buttons etc., but when I delete a file, I get the following:-
quote: Server object error 'ASP 0177 : 800a0034'
Server.CreateObject Failed
/rdonline/forum/myfiles.asp, line 89
The operation completed successfully.
Could this be a permissions issue? I'm on an intranet, but don't actually own the server it's all sitting on....
Any help gratefully appreciated!
I'm an idiot! All now working properly. Excellent stuff chaps, great new functionality.
Simon |
Edited by - goldfish on 11 March 2003 10:50:09 |
|
|
tknospdr
Starting Member
6 Posts |
Posted - 20 April 2003 : 08:18:38
|
Okay, I read through this thread and most of it's above my head. I can copy and paste with the best of them but I really don't know squat about ASP so forgive me. I don't think my particular problem has been addressed here so I'll do my best to describe it and hope you guys can come up with a solution.
First I installed the file upload mod and it worked fine. Then I installed the additions and I was able to use the file that I had previously uploaded.
My problem is that now when I try to upload a new file, the pop up window opens fine and I can browse to a file alright but when I click to post it I get a generic "The page cannot be displayed" error. That only happens if the criteria for upload are correct. When I choose a file that won't work (too big for example) the correct page telling me why I can't upload it comes up.
I've got some other questions but I'd like to get this fixed first.
You can try it out and see for yourself at www.technospider.com/snitz/
Thanks, David |
|
|
pricha
Starting Member
1 Posts |
Posted - 20 April 2003 : 19:08:11
|
My forum setup on brinkster's server. Can I use File Attachment mod? and how?
Thankyou |
|
|
tknospdr
Starting Member
6 Posts |
Posted - 20 April 2003 : 21:05:44
|
I answered my own question. In the directions for the original mod it says to name the folder 'uploaded' and in the add on it mentions 'uploads'. The word 'uploads' was hard coded into the page 'outputfile.asp' in a few places. I changed that and now it works. |
|
|
tknospdr
Starting Member
6 Posts |
Posted - 21 April 2003 : 15:05:18
|
Alright, here's my next question. How do I increase the file size limit?
And also, is the only reason that these are separated for our own clarity, or is there another reason?
case ".jpg", ".jpeg", ".gif", ".png" '##Image File extensions
allowFile=true
ImageFileType=true
case ".txt", ".doc", ".pdf" '##Downloadable file extensions
I need to allow my members to upload video clips and want to make sure that I put the allowed extensions in the right line if it matters. |
|
|
tknospdr
Starting Member
6 Posts |
Posted - 26 April 2003 : 19:29:02
|
Anyone? I'm kinda in a bind since I don't really know how to read ASP code. |
|
|
goldfish
New Member
82 Posts |
Posted - 28 April 2003 : 07:04:21
|
File size changes are in about line 44 of outputfile.asp, as below...
If allowFile and byteCount <= 500000 Then '##Maximum File size
AFAIK the reason for the split is to actually display uploaded images within the thread. If you just wanted them to be downloadable files, you could probably get rid of the following lines...
case ".jpg", ".jpeg", ".gif", ".png" '##Image File extensions
allowFile=true
ImageFileType=true
And integrate the extensions only alongside the PDFs, etc... that's just a guess as I'm no asp guru myself, but it seems logical.... not sure why you'd WANT to do that, but hey... whatever floats your boat....
[edit]Just read your post properly.... just add the video extensions to the pdf etc..... [/edit]
Simon |
Edited by - goldfish on 28 April 2003 07:08:05 |
|
|
Topic |
|
|
|