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
 Mikes File Attachment mod
 New Topic
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 3

Classicmotorcycling
Development Team Leader

Australia
2084 Posts

Posted - 18 April 2013 :  22:54:23  Show Profile
Glad it works... Did not stand out to me first up, then went hang on there was extra characters added, so the length needs increase..

Cheers,

David Greening
Go to Top of Page

Webbo
Average Member

United Kingdom
982 Posts

Posted - 19 April 2013 :  02:39:57  Show Profile  Visit Webbo's Homepage
Well I live and learn - many thanks
Go to Top of Page

richfed
Average Member

United States
999 Posts

Posted - 26 February 2015 :  15:08:19  Show Profile  Visit richfed's Homepage
Suddenly, it has been reported that file attachments are rejecting pictures [proper format]:

Getting this:

Request object error 'ASP 0104 : 80004005'

Operation not Allowed

/messageboard/outputFile.asp, line 13


I tried myself ... it will not take a photo over 90KB. I have never had it set so small. How in the world do I make that size bigger? It's been so long since I set up that MOD, I can no longer recall.

Thanks!

Rich
[size=1]A Complete Idiot's Guide to MOD Implementation || On the Trail of the Last of the Mohicans[/size=1]
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 26 February 2015 :  18:39:10  Show Profile
quote:
Originally posted by richfed

I tried myself ... it will not take a photo over 90KB. I have never had it set so small. How in the world do I make that size bigger? It's been so long since I set up that MOD, I can no longer recall.



Mike configured his in "output_file.asp", line 39:



  If allowFile and byteCount <= 80000 Then



Change the value (80000) to whatever size (in bytes) that you'd like to allow. 80,000 is fairly small. Each KB is 1024 bytes, so that size is just under 80KB. 1MB would be 1048576 bytes.

Edited by - Carefree on 26 February 2015 18:41:01
Go to Top of Page

AnonJr
Moderator

United States
5768 Posts

Posted - 27 February 2015 :  08:48:25  Show Profile  Visit AnonJr's Homepage
If I remember right, there is an upper limit to what IIS will accept using this mod's technique. I don't recall what it was, though I do know it should be more than enough for all but the most abusively large photos. I would suggest looking for that upper limit just so you don't try and set the size constraint higher than what IIS will allow.
Go to Top of Page

golfmann
Junior Member

United States
450 Posts

Posted - 27 February 2015 :  12:14:05  Show Profile  Visit golfmann's Homepage
Is there a way to make it "focus" back to the original "quick reply" post after uploading?
On mine it keeps going to the top of the page and you always have to scroll down... :)

Edited by - golfmann on 28 February 2015 12:07:38
Go to Top of Page

richfed
Average Member

United States
999 Posts

Posted - 27 February 2015 :  13:30:22  Show Profile  Visit richfed's Homepage
Thanks Carefree ... I changed that value to double the 1MB. I tested it and it was working fine for me - last night at 3:15 AM, anyway. :-) We'll see if this fellow has any luck. I don't know why he was having issues - or what happened server side - the MOD has been working well for years. He posts quite frequently - photos of his trips to historical sites. In the past, he has posted full-size images --- he was now being limited to somewhere around that 80KB you mentioned.

Rich
[size=1]A Complete Idiot's Guide to MOD Implementation || On the Trail of the Last of the Mohicans[/size=1]
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 27 February 2015 :  20:40:04  Show Profile
quote:
Originally posted by AnonJr

If I remember right, there is an upper limit to what IIS will accept using this mod's technique. I don't recall what it was, though I do know it should be more than enough for all but the most abusively large photos. I would suggest looking for that upper limit just so you don't try and set the size constraint higher than what IIS will allow.



The upper limit is set by a variable "MaxRequestLength".

For IIS 5/6, in the "web.config" file, you would use something like this (the amount is specified in KB, this gives a limit of 50 MB, timing out after 3600 seconds - 1 hour):

<system.web>
  <httpRuntime maxRequestLength="51200" executionTimeout="3600" />
</system.web>


For IIS 7 and later, in the "web.config" file, change it to this (notice the larger value, it's because they switched to Bytes vs KB):

<system.webServer>
  <security>
    <requestFiltering>
      <requestLimits maxAllowedContentLength="52428800" />
    </requestFiltering>
  </security>
</system.webServer>
Go to Top of Page

shaggy073077
Starting Member

29 Posts

Posted - 30 October 2015 :  03:17:45  Show Profile  Send shaggy073077 an AOL message  Send shaggy073077 a Yahoo! Message
Ok guys this is my code can someone please fix this the file size for me? I have tried modding it like what you guys said but it doesn't work. So here goes:
This is outputfile.asp
<%
'#################################################################################
'## Snitz Forums 2000 v3.4.04
'#################################################################################
'## Copyright (C) 2000-04 Michael Anderson, Pierre Gorissen,
'## Huw Reddick and Richard Kinser
'##
'## 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 (at your option) 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 our support forums at:
'## http://forum.snitz.com
'##
'## Correspondence and Marketing Questions can be sent to:
'## manderson@snitz.com
'##
'#################################################################################
'#
'# proeder's file attachment V1.2 for Snitz Forums - Support can be obtained from
'# http://demoforum.sharepointing.com
'# Author: Philipp Roeder (post@proeder.com)
'#
'#################################################################################
%>

<!--#include file="upload.asp"-->
<!--#INCLUDE FILE="config.asp" -->

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

'########### Check Server TimeOut ##############################################

strSQL = "SELECT UPLOAD_VALUE FROM FORUM_UPSIZE WHERE UPLOAD_VAR = 'STRTIMEOUT'"
set rsTime = my_Conn.Execute (strSQL)
strTimeOut = rsTime("UPLOAD_VALUE")
rsTime.Close
set rsTime = nothing
Server.ScriptTimeout = strTimeOut

'###################################################################################

subfolder = strForumUrl & strUploadUrl
iconimage = strImageUrl & "icon_paperclip.gif"


Response.Expires=0
Response.Buffer = TRUE
Response.Clear

byteCount = Request.TotalBytes
RequestBin = Request.BinaryRead(byteCount)
Dim UploadRequest
Set UploadRequest = CreateObject("Scripting.Dictionary")
BuildUploadRequest RequestBin
membername = UploadRequest.Item("memberName").Item("Value")
subfolder = subfolder & "/" & membername
contentType = UploadRequest.Item("blob").Item("ContentType")
filepathname = UploadRequest.Item("blob").Item("FileName")
filename = Right(filepathname,Len(filepathname)-InstrRev(filepathname,"\"))
oldfilename = filename
filename = Year(Now) & Month(Now) & Day(Now) & Hour(Now) & Minute(Now) & Second(Now) & "_" & filename


' --- CHECK FILE FOR ACCEPTABILITY ---

if oldfilename = "" then
response.redirect "pop_upload_new.asp"
else
extension = LCase(Mid(filename,InStrRev(filename,".")))
end if

ImageFileType=false
AllowFile=false
AllowExpression=false

'## Forum_SQL

'##### Check for allowed extensions

strSQL = "SELECT EXTENSION FROM " & strTablePrefix & "CONFIG_EXTENSION WHERE " & vbNewLine
strSQL = strSQL & "EXTENSION = '" & extension & "' "
set rsExt = my_Conn.Execute (strSQL)

if rsExt.EOF or rsExt.BOF then
AllowFile=false
else
AllowFile=true
end if

rsExt.close
set rsExt = nothing

'##### check max file size

strSQL = "SELECT UPLOAD_VALUE FROM FORUM_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
select case extension
case ".jpg", ".jpeg", ".gif", ".png", ".bmp"'##Image File extensions

ImageFileType=true
case else'##Downloadable file extensions
ImageFileType=false
end select

'###### Check for invalid chars in filename

if not IsValidString(trim(filename)) then
AllowExpression=false
else
AllowExpression=true
end if


If AllowFile=true and AllowSize=true and AllowExpression=true then

value = UploadRequest.Item("blob").Item("Value")
pathEnd = Len(Server.mappath(Request.ServerVariables("PATH_INFO")))-14

'Create FileSytemObject Component

Set ScriptObject = Server.CreateObject("Scripting.FileSystemObject")

memberPath = Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd) & strUploadURL & "\" & membername

If not ScriptObject.FolderExists(memberPath) then

ScriptObject.createFolder(memberPath)

end if

'Create and Write to a File

Set MyFile = ScriptObject.CreateTextFile(Left(Server.mappath(Request.ServerVariables("PATH_INFO")),pathEnd) & strUploadUrl & "\" & membername & "\" & filename)

For i = 1 to LenB(value)
MyFile.Write chr(AscB(MidB(value,i,1)))
Next

MyFile.Close

If byteCount < 1 Then

strFileSize = Round(byteCount,2) & " Bytes"

ElseIf strFileSize < 0 Then

strFileSize = Round(byteCount/1024,2) & " KB"
Else
strFileSize = Round(byteCount/1048576,2) & " MB"
End If

Response.Write "<html>" & vbNewline
Response.Write "<head>" & vbNewline
Response.Write "<title>File Uploaded.</title>" & vbNewline

If ImageFileType=true then
'################### Insert a picture in post ###############################
%>
<script>
if (opener.document.PostTopic.Message.createTextRange && opener.document.PostTopic.Message.caretPos) {
var caretPos = opener.document.PostTopic.Message.caretPos;
caretPos.text = "\n\n

<% =strFileSize %>";
} else {
opener.document.PostTopic.Message.value+="\n\n

<% =strFileSize %>";
}
</script>
<%
Else
'################### Insert a link to attachement in post ###################
%>
<script>
if (opener.document.PostTopic.Message.createTextRange && opener.document.PostTopic.Message.caretPos) {
var caretPos = opener.document.PostTopic.Message.caretPos;
caretPos.text = "\n\n Attached File:
[url=\"<% =subfolder %>/<% =filename %>\"]<% =oldfilename %>[/url]
<% =strFileSize %>";
} else {
opener.document.PostTopic.Message.value+="\n\n Attached File:
[url=\"<% =subfolder %>/<% =filename %>\"]<% =oldfilename %>[/url]
<% =strFileSize %>";
}
</script>
<%
End If

Response.Write "</head>" & vbNewline
Response.Write "<body link=""" & strLinkColor & """ aLink=""" & strActiveLinkColor & """ vLink=""" & strActiveLinkColor & """ onUnLoad=""window.opener.focus();"">" & vbNewline
Response.Write "<p align=""center"">" & vbNewline
Response.Write " <br><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """><b>The file has been uploaded and will appear in your post.</b></font><br><br><hr size=""1"">" & vbNewline
Response.Write " <table>" & vbNewline
Response.Write " <tr><td><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """><b> Filename </b></font></td><td> <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHiLiteFontColor & """>" & oldfilename & "</font> </td></tr>" & vbNewline
Response.Write " <tr><td><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """><b> Extension </b></font></td><td> <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHiLiteFontColor & """>" & extension & "</font> </td></tr>" & vbNewline
Response.Write " <tr><td><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """><b> Size </b></font></td><td> <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHiLiteFontColor & """>" & strFileSize & "</font> </td></tr>" & vbNewline
Response.Write " <tr><td colspan=""2""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """> You may reuse this file in any new post from now on.<br> In your "My Uploads Directory" you may delete the files you do not need anymore.</font></td></tr>" & vbNewline
Response.Write " </table><hr size=""1"">" & vbNewline
Response.Write "<p align=""center""><a href=""#"" onClick=""window.close();"" style=""text-decoration: none""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """>Close window.</font></a></p>" & vbNewline
Response.Write "</p>" & vbNewline
Response.Write "</body>" & vbNewline
Response.Write "</html>" & vbNewline
Else

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

if AllowFile=false then

Response.Write " <tr><td valign=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """><b> File extension </b></font></td><td valign=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHiLiteFontColor & """>" & extension & "</font> </td><td valign=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """>- this extension is not allowed</font></td></tr>" & vbNewline

end if

if AllowSize = false then

Response.Write " <tr><td><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """><b> Size </b></font></td><td> <font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strHiLiteFontColor & """>" & Round(byteCount/1024,2) & " KB</font> </td><td><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """>The maximum allowed file size is " & strAllowedSize & "</font></td></tr>" & vbNewline

end if

if AllowExpression=false then

Response.Write " <tr><td valign=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """><b>Invalid File Name </b></font></td><td valign=""center""> </td><td valign=""center""><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """ color=""" & strDefaultFontColor & """> The filename may not contain any of these characters:<br> <b>"!#$%^&*()=+{}[]|\;:/?>,<'@<br> Please do not use blank spaces in filenames!</b></font></td></tr>" & vbNewline

end if

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

End If

Function IsValidString(sValidate)
Dim sInvalidChars
Dim bTemp
Dim i
' Disallowed characters
sInvalidChars = "!#$%^&*()=+{}[]|\;:/?>,<'@"
for i = 1 To Len(sInvalidChars)
if InStr(sValidate, Mid(sInvalidChars, i, 1)) > 0 then bTemp = True
if bTemp then Exit For
next
for i = 1 to Len(sValidate)
if Asc(Mid(sValidate, i, 1)) = 160 then bTemp = True
if bTemp then Exit For
next

' extra checks
' no two consecutive dots or spaces
if not bTemp then
bTemp = InStr(sValidate, "..") > 0
end if
if not bTemp then
bTemp = InStr(sValidate, " ") > 0
end if
if not bTemp then
bTemp = (len(sValidate) <> len(Trim(sValidate)))
end if 'Addition for leading and trailing spaces

' if any of the above are true, invalid string
IsValidString = Not bTemp
End Function

'################# Set default Server Time out ###########

Server.ScriptTimeout = 90 ' default timeout

' #####################################################################
%>

Edited by - AnonJr on 30 October 2015 13:26:17
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 30 October 2015 :  04:21:52  Show Profile
quote:
Originally posted by shaggy073077

Ok guys this is my code can someone please fix this the file size for me? I have tried modding it like what you guys said but it doesn't work. So here goes:
This is outputfile.asp


The file needing to be edited is "web.config" from the root directory of your web site.
Go to Top of Page

shaggy073077
Starting Member

29 Posts

Posted - 31 October 2015 :  09:41:56  Show Profile  Send shaggy073077 an AOL message  Send shaggy073077 a Yahoo! Message
Carefree I don't use IIS I use Apache. So now what?
Go to Top of Page

Carefree
Advanced Member

Philippines
4207 Posts

Posted - 31 October 2015 :  10:32:28  Show Profile
See this page.
Go to Top of Page

richfed
Average Member

United States
999 Posts

Posted - 14 January 2016 :  11:42:33  Show Profile  Visit richfed's Homepage
quote:
Originally posted by richfed

Suddenly, it has been reported that file attachments are rejecting pictures [proper format]:

Getting this:

Request object error 'ASP 0104 : 80004005'

Operation not Allowed

/messageboard/outputFile.asp, line 13


I tried myself ... it will not take a photo over 90KB. I have never had it set so small. How in the world do I make that size bigger? It's been so long since I set up that MOD, I can no longer recall.

Thanks!



Suddenly getting this error again. I did as you said last year, Carefree, and all was working. I was just trying to upload a .jpg of 344 KB and the message appeared again.

Here's what my host said [don't know where she got the notion of my upload being OVER 2MB from], but it still doesn't work.

quote:
We investigated first issue and findings are as follows:

Error:
Request object error
'ASP 0104 : 80004005' Operation not Allowed

Reason:
IIS6.0 prevents the upload of files more than +200Kb. So you need to make some changes in the default IIS settings first. Which I have changed yesterday. Then on further investigation we found that you have defined Maximum File size in /messageboard/outputFile.asp and the ine is as follows :

If allowFile and byteCount <= 2097152 Then '##Maximum File size which is set to 2MB max size. And it seems that you are uploading file of more than 2 MB.

Now, I have increased Maximum File size to 20 MB as follows:
If allowFile and byteCount <= 20971520 Then '##Maximum File size



So, for the moment, I am stuck.
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 14 January 2016 :  11:49:00  Show Profile  Visit HuwR's Homepage
I would hazard a very good gues that this relates to the issue discussed here http://forum.snitz.com/Mvc/Topic/Posts/71086?pagenum=1

A MS update broke asp uploading.
Go to Top of Page

richfed
Average Member

United States
999 Posts

Posted - 14 January 2016 :  12:22:45  Show Profile  Visit richfed's Homepage
Yeah, I sent that link to them already, along with MS hotfix link. No reply, yet. Thanks, HuwR.

Rich
[size=1]A Complete Idiot's Guide to MOD Implementation || On the Trail of the Last of the Mohicans[/size=1]
Go to Top of Page
Page: of 3 Previous Topic Topic Next Topic  
Previous Page | Next Page
 New Topic
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.42 seconds. Powered By: Snitz Forums 2000 Version 3.4.07