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

 All Forums
 Help Groups for Snitz Forums 2000 Users
 Help: MOD Implementation
 File Attachment Upload Error :- HuwR's MOD
 New Topic  Topic Locked
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 3

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 30 June 2001 :  11:13:19  Show Profile  Visit HuwR's Homepage
That still doesn't expalin why your strCookieURL is incorrect, although it avoids the problem.

Go to Top of Page

SalmanKhana
Average Member

USA
961 Posts

Posted - 30 June 2001 :  15:40:31  Show Profile
quote:

That still doesn't expalin why your strCookieURL is incorrect, although it avoids the problem.





I dont know why was strCookieURL incorrect. I just straight away implemented your code, put your files and thats it. There might be something in your files that makes it go wrong. I think i've seen it that it adds /Mods to strCookieURL but I'm not sure where.

Do you mind checking it out and fixing the UploadEngine.asp please ?

Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 30 June 2001 :  16:07:26  Show Profile  Visit HuwR's Homepage
I checked the coed in the zipe file, this is the savedoc function


private function saveDoc()
Dim strRoot
Dim strFile
Dim fso
strRoot = replace(strCookieURL,"/mods/","/",1,-1,1) & "uploaded"
strRoot = Server.MapPath(strRoot) & "\" & strFolder

strFile = strRoot & "\" & objUpload.Files.Item(0).FileName
Set fso = Server.CreateObject("Scripting.FileSystemObject")
If not fso.FolderExists(strRoot) then

fso.createFolder(strRoot)
end if
objUpload.Files.Item(0).Save strRoot
saveDoc = (fso.FileExists(strFile))
End Function


note the line in red.
This was taken from the uploadengine in the zip file in completed mods

Go to Top of Page

SalmanKhana
Average Member

USA
961 Posts

Posted - 30 June 2001 :  16:51:20  Show Profile
the above code is for the download one. But the code inside the show image is changed as follows :-

private function saveDoc()

Dim strFile
Dim fso
server.scriptTimeout = cLng(ServerTimeout)
strRoot = Server.MapPath(strCookieURL & "../uploaded") & GetSlash & strFolder
strFile = strRoot & GetSlash & objUpload.Files.Item(0).FileName
Set fso = Server.CreateObject("Scripting.FileSystemObject")
If not fso.FolderExists(strRoot) then

So where do u think is the problem ? It will be helpful to know even though I've it running fine.

Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 30 June 2001 :  17:04:40  Show Profile  Visit HuwR's Homepage
just replace your line

strRoot = Server.MapPath(strCookieURL & "../uploaded") & GetSlash & strFolder
with the one in red in my above post.

The problem is, the original MOD was made to run form the mods directory, but my next version has been moved to the main forum directory because people were getting permissions problems trying to execute it from a subdir.
The code for the images was added to my newest code, not the original, which is why there is that difference.

Go to Top of Page

SalmanKhana
Average Member

USA
961 Posts

Posted - 30 June 2001 :  17:30:32  Show Profile
o ahan. I get it. Thanks for the fix. I hope you updated in the uploadengine.asp link too on that site.

Now my forum is working but i'll use this MOD on my portal too, so it'll be helpful

thanks again !

Go to Top of Page

DaveH
Starting Member

6 Posts

Posted - 03 July 2001 :  10:44:45  Show Profile
I'm trying to add this same mod - but with no luck, I've made all the changes here, but all that happens when i click upload is that I get a "page cannot be displayed error" - it works perfectly with the old uploadengine! - any ideas?!

many thanks - Dave

quote:

just replace your line

strRoot = Server.MapPath(strCookieURL & "../uploaded") & GetSlash & strFolder
with the one in red in my above post.

The problem is, the original MOD was made to run form the mods directory, but my next version has been moved to the main forum directory because people were getting permissions problems trying to execute it from a subdir.
The code for the images was added to my newest code, not the original, which is why there is that difference.





Go to Top of Page

SalmanKhana
Average Member

USA
961 Posts

Posted - 04 July 2001 :  00:49:54  Show Profile
What is you website's address .. I guess i can help.. I implemented uploading images in my forums and portal forums .

sal.

Go to Top of Page

DaveH
Starting Member

6 Posts

Posted - 04 July 2001 :  08:43:29  Show Profile
That would be great - http://pg3.net - shall I email you the ftp and stuff?

Thanks!

quote:

What is you website's address .. I guess i can help.. I implemented uploading images in my forums and portal forums .

sal.







Edited by - daveH on 04 July 2001 08:50:36
Go to Top of Page

SalmanKhana
Average Member

USA
961 Posts

Posted - 04 July 2001 :  13:51:30  Show Profile
dude !!!!! i see what is ur problem...

wait i will email you another uploadengine.asp .... i am sorry i am having my finals so i'm kind of busy .. but if it still does not work till friday.. i'll personally check it on your server.. alright.

i am emailing you the uploadengine.asp file !!

the problem was that you had the forum in your root directory where as I assumed that it might be in your /forum .. anyways thanx for putting the URL..

take it easy

sal.

Go to Top of Page

tbowman
Starting Member

4 Posts

Posted - 11 July 2001 :  12:34:24  Show Profile
I get the same error. I have followed all the steps here but it still doesn't work. I still get

Uploading.... Please wait
Microsoft VBScript runtime error '800a004c'

Path not found

/forum/Mods/UploadEngine.asp, line 164
If I use the original code I got, it says it uploads the file to the mods folder, but it doesn't. The server works because uploading an image as a link works just fine. Any help would be greatly appreciated. http://www.deep6racing.com/forum

Here is my code
<%
'#################################################################################
'## Copyright (C) 2000 Michael Anderson and Pierre Gorissen
'##
'## This program is free software; you can redistribute it and/or
'## modify it under the terms of the GNU General Public License
'## as published by the Free Software Foundation; either version 2
'## of the License, or any later version.
'##
'## All copyright notices regarding Snitz Forums 2000
'## must remain intact in the scripts and in the outputted HTML
'## The "powered by" text/logo with a link back to
'## http://forum.snitz.com in the footer of the pages MUST
'## remain visible when the pages are viewed on the internet or intranet.
'##
'## This program is distributed in the hope that it will be useful,
'## but WITHOUT ANY WARRANTY; without even the implied warranty of
'## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
'## GNU General Public License for more details.
'##
'## You should have received a copy of the GNU General Public License
'## along with this program; if not, write to the Free Software
'## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
'##
'## Support can be obtained from support forums at:
'## http://forum.snitz.com
'##
'## Correspondence and Marketing Questions can be sent to:
'## reinhold@bigfoot.com
'##
'## or
'##
'## Snitz Communications
'## C/O: Michael Anderson
'## PO Box 200
'## Harpswell, ME 04079
'#################################################################################
'# File Attachment Mod by Huw Reddick
'#################################################################################
%>
<!--#include file="../config.asp"-->
<!--#include file="../inc_functions.asp"-->
<!-- #include file="../include/clsUpload.inc" -->

<%
'--- Object to parse the input ---
Dim objUpload
Dim strRoot
Dim strFolder
Dim MaxFileSize
Dim boolAllowedType
Dim strAllowedExtensions
Dim strResult
Dim faname
Dim boolSuccess
Dim intFileLen
Dim ImageFile
Dim ServerTimeout

ServerTimeout = 10000

set my_Conn= Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString

Set objDict = Server.CreateObject("Scripting.Dictionary")
set objRec = my_Conn.execute("SELECT * FROM " & strTablePrefix & "MODS WHERE M_NAME = 'Attachment' OR M_CODE = 'Attachment'")

while not objRec.EOF
objDict.Add objRec.Fields.Item("m_code").Value, objRec.Fields.Item("m_value").Value
objRec.moveNext
wend

MaxFileSize = cLng(objDict.Item("faMaxSize"))*512
strAllowedExtensions = objDict.Item("faExtensions")
boolAllowUploads = cint(objDict.Item("Attachment"))

objRec.Close
set objDict = nothing
set my_Conn = nothing


strResult = "Finished..."

If Request.TotalBytes > 0 Then
Set objUpload = new clsUpload
objUpload.ParseRequest
If (objUpload.Files.Count = 1) Then
strFolder = objUpload.Form.Item("Folder")
TopicID = objUpload.Form.Item("TOPIC_ID")
ReplyID = objUpload.Form.Item("REPLY_ID")
ServerTimeout = objUpload.Form.Item("TimeOut")
if ReplyId = "" then
ReplyID = -1
end if
if TopicID = "" then
TopicID = -1
end if
MemberID = objUpload.Form.Item("MEMBER_ID")
faname = objUpload.Files.Item(0).FileName
boolAllowedType = Instr(strAllowedExtensions, Right(objUpload.Files.Item(0).FileName,4)) > 0
ImageFile = Instr(".jpg,.gif", Right(objUpload.Files.Item(0).FileName,4)) > 0
intFileLen = len(objUpload.Files.Item(0).Blob)
if intFileLen > MaxFileSize then
strResult = "File is too Large to upload"
else
if boolAllowedType then
Response.write "Uploading.... Please wait"
boolSuccess = saveDoc()
If boolSuccess = "True" Then
intoDB()

strResult = "The File " & objUpload.Files.Item(0).FileName & " was uploaded to the Server"
End If
else
strResult = "File Type Not Allowed"
end if
end if
Else
strResult = "No file to upload."
End If
End If


'---------------------------------------------------------------------------
'- Function : intoDB
'- Description : inserts the document information in the database
'---------------------------------------------------------------------------
Private Function intoDB()
Dim strSQL
set my_Conn= Server.CreateObject("ADODB.Connection")
my_Conn.Open strConnString
set rs= Server.CreateObject("ADODB.Recordset")
strSQL = "INSERT INTO " & strMemberTablePrefix & "USERFILES (MEMBER_ID,F_FILENAME,F_FILESIZE,F_TOPIC_ID,F_REPLY_ID) VALUES("
strSQL = strSQL & MemberID & ", "
strSQL = strSQL & "'" & objUpload.Files.Item(0).FileName
strSQL = strSQL & "'," & intFileLen & ", "
strSQL = strSQL & TopicID & ", "
strSQL = strSQL & ReplyID & ")"
my_Conn.execute( strSQL )
strSQL = "SELECT F_FILEID FROM " & strMemberTablePrefix & "USERFILES WHERE MEMBER_ID=" & MemberID
strSQL = strSQL & " AND F_TOPIC_ID=" & TopicID & " AND F_REPLY_ID=" & ReplyID
if not ImageFile then
set rs = Server.CreateObject("ADODB.Recordset")
rs.open strSql, my_Conn, 3
faname = rs("F_FILEID")
rs.close
end if
my_conn.close
End Function

'---------------------------------------------------------------------------
'- Function : saveDoc
'---------------------------------------------------------------------------
private function saveDoc()

Dim strFile
Dim fso
server.scriptTimeout = cLng(ServerTimeout)
strRoot = replace(strCookieURL,"/mods/","/",1,-1,1) & "uploaded"
strFile = strRoot & GetSlash & objUpload.Files.Item(0).FileName
Set fso = Server.CreateObject("Scripting.FileSystemObject")
If not fso.FolderExists(strRoot) then

fso.createFolder(strRoot)
end if
objUpload.Files.Item(0).Save strRoot
saveDoc = (fso.FileExists(strFile))
End Function

Function GetSlash
strAspOs = UCase(Request.ServerVariables("ASP_OS"))
If InStr(strAspOs,"WINDOWS") Then
GetSlash = "\"
Else
GetSlash = "/"
End If
end function

%>
<html>

<head>
<title><% =strForumTitle %></title>
<meta name="copyright" content="This code is Copyright (C) 2000 Michael Anderson">
<Style><!--
a:link {color:<% =strLinkColor %>;text-decoration:<% =strLinkTextDecoration %>}
a:visited {color:<% =strVisitedLinkColor %>;text-decoration:<% =strVisitedTextDecoration %>}
a:hover {color:<% =strHoverFontColor %>;text-decoration:<% =strHoverTextDecoration %>}
--></style>
</head>

<BODY bgColor="<% =strPageBGColor %>" text="<% =strDefaultFontColor %>" link="<% =strLinkColor %>" aLink=<% =strActiveLinkColor %> vLink="<% =strActiveLinkColor %>" onLoad="window.focus()">

<table width="100%" height="100%">
<tr>
<td align=center valign=center>
<div align=center><center>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">

<p> <%=strResult%></p><br><br>

<p>
<% if imageFile then %>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><a href="JavaScript:onClick= addimage()">Close Window</A></font>
<% Else %>
<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><a href="JavaScript:onClick= addfile()">Close Window</A></font>
<% End If %>
</p>
</font>
</center></div>
</td>
</tr>
</table>
<script language="JavaScript">
<!--
function addfile()
{
var fname, resultString
resultString ='<%= boolSuccess %>';
fname = '<%= faname %>';
if (resultString)
window.opener.document.PostTopic.Message.value+= 'download';
window.close();
}

//-->
</script>
<script language="JavaScript">
<!--
function addimage()
{
var fname, resultString
resultString ='<%= boolSuccess %>';
fname = '<%= faname %>';
if (resultString)
window.opener.document.PostTopic.Message.value+= '';
window.close();
}

//-->
</script>

</BODY>
</HTML>




quote:

just replace your line

strRoot = Server.MapPath(strCookieURL & "../uploaded") & GetSlash & strFolder
with the one in red in my above post.

The problem is, the original MOD was made to run form the mods directory, but my next version has been moved to the main forum directory because people were getting permissions problems trying to execute it from a subdir.
The code for the images was added to my newest code, not the original, which is why there is that difference.





Go to Top of Page

SalmanKhana
Average Member

USA
961 Posts

Posted - 11 July 2001 :  16:56:49  Show Profile
dude, what do u wanna do ? upload files or images to show right away?

Go to Top of Page

tbowman
Starting Member

4 Posts

Posted - 11 July 2001 :  17:04:48  Show Profile
Yes, I want the pics to show in the post, I got it initially to work as a link, but now I want it to show up in the post.

Thanks



quote:

dude, what do u wanna do ? upload files or images to show right away?





Go to Top of Page

SalmanKhana
Average Member

USA
961 Posts

Posted - 11 July 2001 :  20:50:39  Show Profile
that is easy.. so whaz the matter ?/ define ur problem

dude i am sorry if i reply late.. i have summer skool and my site stuff n mods to install.. but i'll make sure i reply to u as soon as possible..

take it easy and lemme know exactly what is the problem ur having and also copy a link to ur website plz

thanx

sal

Go to Top of Page

tbowman
Starting Member

4 Posts

Posted - 12 July 2001 :  08:52:20  Show Profile
Ok, I first setup the mod to upload a picture as a link. This worked great! I then proceeded to change the mod so the image would show up in the post instead. I made the necessary changes, but it didn't work. It was trying to upload the file to the /forum/mods/uploaded... directory. I proceeded to search this site and found this forum. I made the necessary changes that you stated in "red", and I get a different error stating
Microsoft VBScript runtime error '800a004c'

Path not found

/forum/Mods/UploadEngine.asp, line 169
. The site is http://www.deep6racing.com/forum and my first post I copied my uplodengine.asp in there so you can take a look at it. Thanks for all the help

Go to Top of Page
Page: of 3 Previous Topic Topic Next Topic  
Previous Page | Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.28 seconds. Powered By: Snitz Forums 2000 Version 3.4.07