473,394 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Timeout? in asp script upload

Hello,

I got the following scripts to upload files to my directories

I call insert.htm

Browse for a file, then click 'submit'

It works for small files, and for a small .mdb (access file)

But for any larger file, it quits and give me 'page not found'

Is there some kind of timeout I can set?

Note: insert.htm calls insert.asp, call load.asp

Thanks:

Insert.asp:

<!-- insert.htm -->
<html>
<head>
<title>File Uploading with ASP</title>
<style>
body, input { font-family:verdana,arial; font-size:10pt; }
</style>
</head>
<body>
<p align="center">
<b>File Uploading with ASP</b><br>
<a href="show.asp">To see uploaded data click here</a>
</p>

<table border="0" align="center">
<tr>
<form method="POST" enctype="multipart/form-data" action="Insert.asp">
<td>Name :</td><td>
<input type="text" name="name" size="40"></td></tr>
<td>File :</td><td>
<input type="file" name="file" size="40"></td></tr>
<td> </td><td>
<input type="submit" value="Submit"></td></tr>
</form>
</tr>
</table>

</body>
</html>
insert.asp:

<% ' Insert.asp %>
<!--#include file="Loader.asp"-->
<%

Response.Buffer = True

' load object
Dim load
Set load = new Loader

' calling initialize method
load.initialize
response.write "<br>hi1122"

' File binary data
Dim fileData
fileData = load.getFileData("file")
' File name
Dim fileName
fileName = LCase(load.getFileName("file"))
' File path
Dim filePath
filePath = load.getFilePath("file")
' File path complete
Dim filePathComplete
filePathComplete = load.getFilePathComplete("file")
' File size
Dim fileSize
fileSize = load.getFileSize("file")
' File size translated
Dim fileSizeTranslated
fileSizeTranslated = load.getFileSizeTranslated("file")
' Content Type
Dim contentType
contentType = load.getContentType("file")
' No. of Form elements
Dim countElements
countElements = load.Count
' Value of text input field "name"
Dim nameInput
nameInput = load.getValue("name")
' Path where file will be uploaded
Dim pathToFile
' pathToFile = Server.mapPath("uploaded/") & "\" & fileName
pathToFile = Server.mapPath("businesssearch/") & "\" & fileName
' Uploading file data
response.write "<br>hi112233"
response.write "<br> " & pathtofile
'response.end
Dim fileUploaded
fileUploaded = load.saveToFile ("file", pathToFile)
'response.write "<br>hi112233444"
'response.end
' destroying load object
Set load = Nothing
%>

<html>
<head>
<title>File Uploading with ASP</title>
<style>
body, input, td { font-family:verdana,arial; font-size:10pt; }
</style>
</head>
<body>
<p align="center">
<b>File Uploading with ASP</b><br>
<a href="show.asp">To see uploaded files click here</a>
</p>

<table width="700" border="1" align="center">
<tr>
<td>File Name</td><td><%= fileName %></td>
</tr><tr>
<td>File Path</td><td><%= filePath %></td>
</tr><tr>
<td>File Path Complete</td><td><%= filePathComplete %></td>
</tr><tr>
<td>File Size</td><td><%= fileSize %></td>
</tr><tr>
<td>File Size Translated</td><td><%= fileSizeTranslated %></td>
</tr><tr>
<td>Content Type</td><td><%= contentType %></td>
</tr><tr>
<td>No. of Form Elements</td><td><%= countElements %></td>
</tr><tr>
<td>Name</td><td><%= nameInput %></td>
</tr>
</table><br><br>

<p style="padding-left:220;">
<%
If fileUploaded = True Then
Response.Write fileName & " data uploaded..."
Else
Response.Write "<font color=""red"">File could not be uploaded..."
Response.Write "</font>"
Response.Write "<br>Please select a file before hitting the
'Submit'"
Response.Write " button."
End If
%>
</p>

<br>
<table border="0" align="center">
<tr>
<form method="POST" enctype="multipart/form-data" action="Insert.asp">
<td>Name :</td><td>
<input type="text" name="name" size="40" value="<%= nameInput %>">
</td></tr>
<td>File :</td><td>
<input type="file" name="file" size="40"></td></tr>
<td> </td><td>
<input type="submit" value="Submit"></td></tr>
</form>
</tr>
</table>

</body>
</html>
loader.asp:

<%
' -- Loader.asp --
' -- version 1.5.2
' -- last updated 12/5/2002
'
' Faisal Khan
' fa****@stardeveloper.com
' www.stardeveloper.com
' Class for handling binary uploads

Class Loader
Private dict

Private Sub Class_Initialize
Set dict = Server.CreateObject("Scripting.Dictionary")
End Sub

Private Sub Class_Terminate
If IsObject(intDict) Then
intDict.RemoveAll
Set intDict = Nothing
End If
If IsObject(dict) Then
dict.RemoveAll
Set dict = Nothing
End If
End Sub

Public Property Get Count
Count = dict.Count
End Property

Public Sub Initialize
If Request.TotalBytes > 0 Then
Dim binData
binData = Request.BinaryRead(Request.TotalBytes)
getData binData
End If
End Sub

Public Function getFileData(name)
If dict.Exists(name) Then
getFileData = dict(name).Item("Value")
Else
getFileData = ""
End If
End Function

Public Function getValue(name)
Dim gv
If dict.Exists(name) Then
gv = CStr(dict(name).Item("Value"))

gv = Left(gv,Len(gv)-2)
getValue = gv
Else
getValue = ""
End If
End Function

Public Function saveToFile(name, path)
If dict.Exists(name) Then
Dim temp
temp = dict(name).Item("Value")
Dim fso
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Dim file
Set file = fso.CreateTextFile(path)
For tPoint = 1 to LenB(temp)
file.Write Chr(AscB(MidB(temp,tPoint,1)))
Next
file.Close
saveToFile = True
Else
saveToFile = False
End If
End Function

Public Function getFileName(name)
If dict.Exists(name) Then
Dim temp, tempPos
temp = dict(name).Item("FileName")
tempPos = 1 + InStrRev(temp, "\")
getFileName = Mid(temp, tempPos)
Else
getFileName = ""
End If
End Function

Public Function getFilePath(name)
If dict.Exists(name) Then
Dim temp, tempPos
temp = dict(name).Item("FileName")
tempPos = InStrRev(temp, "\")
getFilePath = Mid(temp, 1, tempPos)
Else
getFilePath = ""
End If
End Function

Public Function getFilePathComplete(name)
If dict.Exists(name) Then
getFilePathComplete = dict(name).Item("FileName")
Else
getFilePathComplete = ""
End If
End Function

Public Function getFileSize(name)
If dict.Exists(name) Then
getFileSize = LenB(dict(name).Item("Value"))
Else
getFileSize = 0
End If
End Function

Public Function getFileSizeTranslated(name)
If dict.Exists(name) Then
temp = LenB(dict(name).Item("Value"))
If temp <= 1024 Then
getFileSizeTranslated = temp & " bytes"
Else
temp = FormatNumber((temp / 1024), 2)
getFileSizeTranslated = temp & " kilobytes"
End If
Else
getFileSizeTranslated = ""
End If
End Function

Public Function getContentType(name)
If dict.Exists(name) Then
getContentType = dict(name).Item("ContentType")
Else
getContentType = ""
End If
End Function

Private Sub getData(rawData)
Dim separator
separator = MidB(rawData, 1, InstrB(1, rawData, ChrB(13)) - 1)

Dim lenSeparator
lenSeparator = LenB(separator)

Dim currentPos
currentPos = 1
Dim inStrByte
inStrByte = 1
Dim value, mValue
Dim tempValue
tempValue = ""

While inStrByte > 0
inStrByte = InStrB(currentPos, rawData, separator)
mValue = inStrByte - currentPos

If mValue > 1 Then
value = MidB(rawData, currentPos, mValue)

Dim begPos, endPos, midValue, nValue
Dim intDict
Set intDict = Server.CreateObject("Scripting.Dictionary")

begPos = 1 + InStrB(1, value, ChrB(34))
endPos = InStrB(begPos + 1, value, ChrB(34))
nValue = endPos

Dim nameN
nameN = MidB(value, begPos, endPos - begPos)

Dim nameValue, isValid
isValid = True

If InStrB(1, value, stringToByte("Content-Type")) > 1 Then

begPos = 1 + InStrB(endPos + 1, value, ChrB(34))
endPos = InStrB(begPos + 1, value, ChrB(34))

If endPos = 0 Then
endPos = begPos + 1
isValid = False
End If

midValue = MidB(value, begPos, endPos - begPos)
intDict.Add "FileName", trim(byteToString(midValue))

begPos = 14 + InStrB(endPos + 1, value,
stringToByte("Content-Type:"))
endPos = InStrB(begPos, value, ChrB(13))

midValue = MidB(value, begPos, endPos - begPos)
intDict.Add "ContentType", trim(byteToString(midValue))

begPos = endPos + 4
endPos = LenB(value)

nameValue = MidB(value, begPos, ((endPos - begPos) - 1))
Else
nameValue = trim(byteToString(MidB(value, nValue + 5)))
End If

If isValid = True Then

intDict.Add "Value", nameValue
intDict.Add "Name", nameN

dict.Add byteToString(nameN), intDict
End If
End If

currentPos = lenSeparator + inStrByte
Wend
End Sub

End Class

Private Function stringToByte(toConv)
Dim tempChar
For i = 1 to Len(toConv)
tempChar = Mid(toConv, i, 1)
stringToByte = stringToByte & chrB(AscB(tempChar))
Next
End Function

Private Function byteToString(toConv)
For i = 1 to LenB(toConv)
byteToString = byteToString & Chr(AscB(MidB(toConv,i,1)))
Next
End Function
%>
Jul 22 '05 #1
4 2209
I had to add the following:

<httpRuntime executionTimeout="300" maxRequestLength="16384" />

to my web.config for the project to increase the allowed file size to
16M.

Ignus

"Scott Baxter" <sc***@baxtsoft.com> wrote in message
news:uW**************@TK2MSFTNGP09.phx.gbl...
Hello,

I got the following scripts to upload files to my directories

I call insert.htm

Browse for a file, then click 'submit'

It works for small files, and for a small .mdb (access file)

But for any larger file, it quits and give me 'page not found'

Is there some kind of timeout I can set?

Note: insert.htm calls insert.asp, call load.asp

Thanks:

Insert.asp:

<!-- insert.htm -->
<html>
<head>
<title>File Uploading with ASP</title>
<style>
body, input { font-family:verdana,arial; font-size:10pt; }
</style>
</head>
<body>
<p align="center">
<b>File Uploading with ASP</b><br>
<a href="show.asp">To see uploaded data click here</a>
</p>

<table border="0" align="center">
<tr>
<form method="POST" enctype="multipart/form-data" action="Insert.asp">
<td>Name :</td><td>
<input type="text" name="name" size="40"></td></tr>
<td>File :</td><td>
<input type="file" name="file" size="40"></td></tr>
<td> </td><td>
<input type="submit" value="Submit"></td></tr>
</form>
</tr>
</table>

</body>
</html>
insert.asp:

<% ' Insert.asp %>
<!--#include file="Loader.asp"-->
<%

Response.Buffer = True

' load object
Dim load
Set load = new Loader

' calling initialize method
load.initialize
response.write "<br>hi1122"

' File binary data
Dim fileData
fileData = load.getFileData("file")
' File name
Dim fileName
fileName = LCase(load.getFileName("file"))
' File path
Dim filePath
filePath = load.getFilePath("file")
' File path complete
Dim filePathComplete
filePathComplete = load.getFilePathComplete("file")
' File size
Dim fileSize
fileSize = load.getFileSize("file")
' File size translated
Dim fileSizeTranslated
fileSizeTranslated = load.getFileSizeTranslated("file")
' Content Type
Dim contentType
contentType = load.getContentType("file")
' No. of Form elements
Dim countElements
countElements = load.Count
' Value of text input field "name"
Dim nameInput
nameInput = load.getValue("name")
' Path where file will be uploaded
Dim pathToFile
' pathToFile = Server.mapPath("uploaded/") & "\" & fileName
pathToFile = Server.mapPath("businesssearch/") & "\" & fileName
' Uploading file data
response.write "<br>hi112233"
response.write "<br> " & pathtofile
'response.end
Dim fileUploaded
fileUploaded = load.saveToFile ("file", pathToFile)
'response.write "<br>hi112233444"
'response.end
' destroying load object
Set load = Nothing
%>

<html>
<head>
<title>File Uploading with ASP</title>
<style>
body, input, td { font-family:verdana,arial; font-size:10pt; }
</style>
</head>
<body>
<p align="center">
<b>File Uploading with ASP</b><br>
<a href="show.asp">To see uploaded files click here</a>
</p>

<table width="700" border="1" align="center">
<tr>
<td>File Name</td><td><%= fileName %></td>
</tr><tr>
<td>File Path</td><td><%= filePath %></td>
</tr><tr>
<td>File Path Complete</td><td><%= filePathComplete %></td>
</tr><tr>
<td>File Size</td><td><%= fileSize %></td>
</tr><tr>
<td>File Size Translated</td><td><%= fileSizeTranslated %></td>
</tr><tr>
<td>Content Type</td><td><%= contentType %></td>
</tr><tr>
<td>No. of Form Elements</td><td><%= countElements %></td>
</tr><tr>
<td>Name</td><td><%= nameInput %></td>
</tr>
</table><br><br>

<p style="padding-left:220;">
<%
If fileUploaded = True Then
Response.Write fileName & " data uploaded..."
Else
Response.Write "<font color=""red"">File could not be uploaded..."
Response.Write "</font>"
Response.Write "<br>Please select a file before hitting the
'Submit'"
Response.Write " button."
End If
%>
</p>

<br>
<table border="0" align="center">
<tr>
<form method="POST" enctype="multipart/form-data" action="Insert.asp">
<td>Name :</td><td>
<input type="text" name="name" size="40" value="<%= nameInput %>">
</td></tr>
<td>File :</td><td>
<input type="file" name="file" size="40"></td></tr>
<td> </td><td>
<input type="submit" value="Submit"></td></tr>
</form>
</tr>
</table>

</body>
</html>
loader.asp:

<%
' -- Loader.asp --
' -- version 1.5.2
' -- last updated 12/5/2002
'
' Faisal Khan
' fa****@stardeveloper.com
' www.stardeveloper.com
' Class for handling binary uploads

Class Loader
Private dict

Private Sub Class_Initialize
Set dict = Server.CreateObject("Scripting.Dictionary")
End Sub

Private Sub Class_Terminate
If IsObject(intDict) Then
intDict.RemoveAll
Set intDict = Nothing
End If
If IsObject(dict) Then
dict.RemoveAll
Set dict = Nothing
End If
End Sub

Public Property Get Count
Count = dict.Count
End Property

Public Sub Initialize
If Request.TotalBytes > 0 Then
Dim binData
binData = Request.BinaryRead(Request.TotalBytes)
getData binData
End If
End Sub

Public Function getFileData(name)
If dict.Exists(name) Then
getFileData = dict(name).Item("Value")
Else
getFileData = ""
End If
End Function

Public Function getValue(name)
Dim gv
If dict.Exists(name) Then
gv = CStr(dict(name).Item("Value"))

gv = Left(gv,Len(gv)-2)
getValue = gv
Else
getValue = ""
End If
End Function

Public Function saveToFile(name, path)
If dict.Exists(name) Then
Dim temp
temp = dict(name).Item("Value")
Dim fso
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Dim file
Set file = fso.CreateTextFile(path)
For tPoint = 1 to LenB(temp)
file.Write Chr(AscB(MidB(temp,tPoint,1)))
Next
file.Close
saveToFile = True
Else
saveToFile = False
End If
End Function

Public Function getFileName(name)
If dict.Exists(name) Then
Dim temp, tempPos
temp = dict(name).Item("FileName")
tempPos = 1 + InStrRev(temp, "\")
getFileName = Mid(temp, tempPos)
Else
getFileName = ""
End If
End Function

Public Function getFilePath(name)
If dict.Exists(name) Then
Dim temp, tempPos
temp = dict(name).Item("FileName")
tempPos = InStrRev(temp, "\")
getFilePath = Mid(temp, 1, tempPos)
Else
getFilePath = ""
End If
End Function

Public Function getFilePathComplete(name)
If dict.Exists(name) Then
getFilePathComplete = dict(name).Item("FileName")
Else
getFilePathComplete = ""
End If
End Function

Public Function getFileSize(name)
If dict.Exists(name) Then
getFileSize = LenB(dict(name).Item("Value"))
Else
getFileSize = 0
End If
End Function

Public Function getFileSizeTranslated(name)
If dict.Exists(name) Then
temp = LenB(dict(name).Item("Value"))
If temp <= 1024 Then
getFileSizeTranslated = temp & " bytes"
Else
temp = FormatNumber((temp / 1024), 2)
getFileSizeTranslated = temp & " kilobytes"
End If
Else
getFileSizeTranslated = ""
End If
End Function

Public Function getContentType(name)
If dict.Exists(name) Then
getContentType = dict(name).Item("ContentType")
Else
getContentType = ""
End If
End Function

Private Sub getData(rawData)
Dim separator
separator = MidB(rawData, 1, InstrB(1, rawData, ChrB(13)) - 1)

Dim lenSeparator
lenSeparator = LenB(separator)

Dim currentPos
currentPos = 1
Dim inStrByte
inStrByte = 1
Dim value, mValue
Dim tempValue
tempValue = ""

While inStrByte > 0
inStrByte = InStrB(currentPos, rawData, separator)
mValue = inStrByte - currentPos

If mValue > 1 Then
value = MidB(rawData, currentPos, mValue)

Dim begPos, endPos, midValue, nValue
Dim intDict
Set intDict = Server.CreateObject("Scripting.Dictionary")

begPos = 1 + InStrB(1, value, ChrB(34))
endPos = InStrB(begPos + 1, value, ChrB(34))
nValue = endPos

Dim nameN
nameN = MidB(value, begPos, endPos - begPos)

Dim nameValue, isValid
isValid = True

If InStrB(1, value, stringToByte("Content-Type")) > 1 Then

begPos = 1 + InStrB(endPos + 1, value, ChrB(34))
endPos = InStrB(begPos + 1, value, ChrB(34))

If endPos = 0 Then
endPos = begPos + 1
isValid = False
End If

midValue = MidB(value, begPos, endPos - begPos)
intDict.Add "FileName", trim(byteToString(midValue))

begPos = 14 + InStrB(endPos + 1, value,
stringToByte("Content-Type:"))
endPos = InStrB(begPos, value, ChrB(13))

midValue = MidB(value, begPos, endPos - begPos)
intDict.Add "ContentType", trim(byteToString(midValue))

begPos = endPos + 4
endPos = LenB(value)

nameValue = MidB(value, begPos, ((endPos - begPos) - 1))
Else
nameValue = trim(byteToString(MidB(value, nValue + 5)))
End If

If isValid = True Then

intDict.Add "Value", nameValue
intDict.Add "Name", nameN

dict.Add byteToString(nameN), intDict
End If
End If

currentPos = lenSeparator + inStrByte
Wend
End Sub

End Class

Private Function stringToByte(toConv)
Dim tempChar
For i = 1 to Len(toConv)
tempChar = Mid(toConv, i, 1)
stringToByte = stringToByte & chrB(AscB(tempChar))
Next
End Function

Private Function byteToString(toConv)
For i = 1 to LenB(toConv)
byteToString = byteToString & Chr(AscB(MidB(toConv,i,1)))
Next
End Function
%>

Jul 22 '05 #2
If the server OS is 2003, that OS has a 200 KB upload limit. It can be
increased by editting the metabase.xml file.

MIke

"Scott Baxter" wrote:
Hello,

I got the following scripts to upload files to my directories

I call insert.htm

Browse for a file, then click 'submit'

It works for small files, and for a small .mdb (access file)

But for any larger file, it quits and give me 'page not found'

Is there some kind of timeout I can set?

Note: insert.htm calls insert.asp, call load.asp

Thanks:

Insert.asp:

<!-- insert.htm -->
<html>
<head>
<title>File Uploading with ASP</title>
<style>
body, input { font-family:verdana,arial; font-size:10pt; }
</style>
</head>
<body>
<p align="center">
<b>File Uploading with ASP</b><br>
<a href="show.asp">To see uploaded data click here</a>
</p>

<table border="0" align="center">
<tr>
<form method="POST" enctype="multipart/form-data" action="Insert.asp">
<td>Name :</td><td>
<input type="text" name="name" size="40"></td></tr>
<td>File :</td><td>
<input type="file" name="file" size="40"></td></tr>
<td> </td><td>
<input type="submit" value="Submit"></td></tr>
</form>
</tr>
</table>

</body>
</html>
insert.asp:

<% ' Insert.asp %>
<!--#include file="Loader.asp"-->
<%

Response.Buffer = True

' load object
Dim load
Set load = new Loader

' calling initialize method
load.initialize
response.write "<br>hi1122"

' File binary data
Dim fileData
fileData = load.getFileData("file")
' File name
Dim fileName
fileName = LCase(load.getFileName("file"))
' File path
Dim filePath
filePath = load.getFilePath("file")
' File path complete
Dim filePathComplete
filePathComplete = load.getFilePathComplete("file")
' File size
Dim fileSize
fileSize = load.getFileSize("file")
' File size translated
Dim fileSizeTranslated
fileSizeTranslated = load.getFileSizeTranslated("file")
' Content Type
Dim contentType
contentType = load.getContentType("file")
' No. of Form elements
Dim countElements
countElements = load.Count
' Value of text input field "name"
Dim nameInput
nameInput = load.getValue("name")
' Path where file will be uploaded
Dim pathToFile
' pathToFile = Server.mapPath("uploaded/") & "\" & fileName
pathToFile = Server.mapPath("businesssearch/") & "\" & fileName
' Uploading file data
response.write "<br>hi112233"
response.write "<br> " & pathtofile
'response.end
Dim fileUploaded
fileUploaded = load.saveToFile ("file", pathToFile)
'response.write "<br>hi112233444"
'response.end
' destroying load object
Set load = Nothing
%>

<html>
<head>
<title>File Uploading with ASP</title>
<style>
body, input, td { font-family:verdana,arial; font-size:10pt; }
</style>
</head>
<body>
<p align="center">
<b>File Uploading with ASP</b><br>
<a href="show.asp">To see uploaded files click here</a>
</p>

<table width="700" border="1" align="center">
<tr>
<td>File Name</td><td><%= fileName %></td>
</tr><tr>
<td>File Path</td><td><%= filePath %></td>
</tr><tr>
<td>File Path Complete</td><td><%= filePathComplete %></td>
</tr><tr>
<td>File Size</td><td><%= fileSize %></td>
</tr><tr>
<td>File Size Translated</td><td><%= fileSizeTranslated %></td>
</tr><tr>
<td>Content Type</td><td><%= contentType %></td>
</tr><tr>
<td>No. of Form Elements</td><td><%= countElements %></td>
</tr><tr>
<td>Name</td><td><%= nameInput %></td>
</tr>
</table><br><br>

<p style="padding-left:220;">
<%
If fileUploaded = True Then
Response.Write fileName & " data uploaded..."
Else
Response.Write "<font color=""red"">File could not be uploaded..."
Response.Write "</font>"
Response.Write "<br>Please select a file before hitting the
'Submit'"
Response.Write " button."
End If
%>
</p>

<br>
<table border="0" align="center">
<tr>
<form method="POST" enctype="multipart/form-data" action="Insert.asp">
<td>Name :</td><td>
<input type="text" name="name" size="40" value="<%= nameInput %>">
</td></tr>
<td>File :</td><td>
<input type="file" name="file" size="40"></td></tr>
<td> </td><td>
<input type="submit" value="Submit"></td></tr>
</form>
</tr>
</table>

</body>
</html>
loader.asp:

<%
' -- Loader.asp --
' -- version 1.5.2
' -- last updated 12/5/2002
'
' Faisal Khan
' fa****@stardeveloper.com
' www.stardeveloper.com
' Class for handling binary uploads

Class Loader
Private dict

Private Sub Class_Initialize
Set dict = Server.CreateObject("Scripting.Dictionary")
End Sub

Private Sub Class_Terminate
If IsObject(intDict) Then
intDict.RemoveAll
Set intDict = Nothing
End If
If IsObject(dict) Then
dict.RemoveAll
Set dict = Nothing
End If
End Sub

Public Property Get Count
Count = dict.Count
End Property

Public Sub Initialize
If Request.TotalBytes > 0 Then
Dim binData
binData = Request.BinaryRead(Request.TotalBytes)
getData binData
End If
End Sub

Public Function getFileData(name)
If dict.Exists(name) Then
getFileData = dict(name).Item("Value")
Else
getFileData = ""
End If
End Function

Public Function getValue(name)
Dim gv
If dict.Exists(name) Then
gv = CStr(dict(name).Item("Value"))

gv = Left(gv,Len(gv)-2)
getValue = gv
Else
getValue = ""
End If
End Function

Public Function saveToFile(name, path)
If dict.Exists(name) Then
Dim temp
temp = dict(name).Item("Value")
Dim fso
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Dim file
Set file = fso.CreateTextFile(path)
For tPoint = 1 to LenB(temp)
file.Write Chr(AscB(MidB(temp,tPoint,1)))
Next
file.Close
saveToFile = True
Else
saveToFile = False
End If
End Function

Public Function getFileName(name)
If dict.Exists(name) Then
Dim temp, tempPos
temp = dict(name).Item("FileName")
tempPos = 1 + InStrRev(temp, "\")
getFileName = Mid(temp, tempPos)
Else
getFileName = ""
End If
End Function

Public Function getFilePath(name)
If dict.Exists(name) Then
Dim temp, tempPos
temp = dict(name).Item("FileName")
tempPos = InStrRev(temp, "\")
getFilePath = Mid(temp, 1, tempPos)
Else
getFilePath = ""
End If
End Function

Public Function getFilePathComplete(name)
If dict.Exists(name) Then
getFilePathComplete = dict(name).Item("FileName")
Else
getFilePathComplete = ""
End If
End Function

Public Function getFileSize(name)
If dict.Exists(name) Then
getFileSize = LenB(dict(name).Item("Value"))
Else
getFileSize = 0
End If
End Function

Public Function getFileSizeTranslated(name)
If dict.Exists(name) Then
temp = LenB(dict(name).Item("Value"))
If temp <= 1024 Then
getFileSizeTranslated = temp & " bytes"
Else
temp = FormatNumber((temp / 1024), 2)
getFileSizeTranslated = temp & " kilobytes"
End If
Else
getFileSizeTranslated = ""
End If
End Function

Public Function getContentType(name)
If dict.Exists(name) Then
getContentType = dict(name).Item("ContentType")
Else
getContentType = ""
End If
End Function

Private Sub getData(rawData)
Dim separator
separator = MidB(rawData, 1, InstrB(1, rawData, ChrB(13)) - 1)

Dim lenSeparator
lenSeparator = LenB(separator)

Dim currentPos
currentPos = 1
Dim inStrByte
inStrByte = 1
Dim value, mValue
Dim tempValue
tempValue = ""

While inStrByte > 0
inStrByte = InStrB(currentPos, rawData, separator)
mValue = inStrByte - currentPos

If mValue > 1 Then
value = MidB(rawData, currentPos, mValue)

Dim begPos, endPos, midValue, nValue
Dim intDict
Set intDict = Server.CreateObject("Scripting.Dictionary")

begPos = 1 + InStrB(1, value, ChrB(34))
endPos = InStrB(begPos + 1, value, ChrB(34))
nValue = endPos

Dim nameN
nameN = MidB(value, begPos, endPos - begPos)

Dim nameValue, isValid
isValid = True

If InStrB(1, value, stringToByte("Content-Type")) > 1 Then

begPos = 1 + InStrB(endPos + 1, value, ChrB(34))
endPos = InStrB(begPos + 1, value, ChrB(34))

If endPos = 0 Then
endPos = begPos + 1
isValid = False
End If

midValue = MidB(value, begPos, endPos - begPos)
intDict.Add "FileName", trim(byteToString(midValue))

begPos = 14 + InStrB(endPos + 1, value,
stringToByte("Content-Type:"))
endPos = InStrB(begPos, value, ChrB(13))

midValue = MidB(value, begPos, endPos - begPos)
intDict.Add "ContentType", trim(byteToString(midValue))

begPos = endPos + 4
endPos = LenB(value)

nameValue = MidB(value, begPos, ((endPos - begPos) - 1))
Else
nameValue = trim(byteToString(MidB(value, nValue + 5)))
End If

If isValid = True Then

intDict.Add "Value", nameValue
intDict.Add "Name", nameN

dict.Add byteToString(nameN), intDict
End If
End If

currentPos = lenSeparator + inStrByte
Wend
End Sub

End Class

Private Function stringToByte(toConv)
Dim tempChar
For i = 1 to Len(toConv)
tempChar = Mid(toConv, i, 1)
stringToByte = stringToByte & chrB(AscB(tempChar))
Next
End Function

Private Function byteToString(toConv)
For i = 1 to LenB(toConv)
byteToString = byteToString & Chr(AscB(MidB(toConv,i,1)))
Next
End Function
%>

Jul 22 '05 #3
Thanks Mike. Where is this file? I tried putting a web.config file, and it
didn't do anything. I put it in the directory where the insert.asp file is,
and the target directory where I wrote it. Here is the web.config I put
there:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<httpRuntime
executionTimeout="300"
maxRequestLength="16384"
/>
</system.web>
</configuration>

Do I need to do a command to get my web site to recognize this? It seemed
to have no effect.

Thanks.

Scott


"Mike D" <Mi***@discussions.microsoft.com> wrote in message
news:11**********************************@microsof t.com...
If the server OS is 2003, that OS has a 200 KB upload limit. It can be
increased by editting the metabase.xml file.

MIke

"Scott Baxter" wrote:
Hello,

I got the following scripts to upload files to my directories

I call insert.htm

Browse for a file, then click 'submit'

It works for small files, and for a small .mdb (access file)

But for any larger file, it quits and give me 'page not found'

Is there some kind of timeout I can set?

Note: insert.htm calls insert.asp, call load.asp

Thanks:

Insert.asp:

<!-- insert.htm -->
<html>
<head>
<title>File Uploading with ASP</title>
<style>
body, input { font-family:verdana,arial; font-size:10pt; }
</style>
</head>
<body>
<p align="center">
<b>File Uploading with ASP</b><br>
<a href="show.asp">To see uploaded data click here</a>
</p>

<table border="0" align="center">
<tr>
<form method="POST" enctype="multipart/form-data" action="Insert.asp">
<td>Name :</td><td>
<input type="text" name="name" size="40"></td></tr>
<td>File :</td><td>
<input type="file" name="file" size="40"></td></tr>
<td> </td><td>
<input type="submit" value="Submit"></td></tr>
</form>
</tr>
</table>

</body>
</html>
insert.asp:

<% ' Insert.asp %>
<!--#include file="Loader.asp"-->
<%

Response.Buffer = True

' load object
Dim load
Set load = new Loader

' calling initialize method
load.initialize
response.write "<br>hi1122"

' File binary data
Dim fileData
fileData = load.getFileData("file")
' File name
Dim fileName
fileName = LCase(load.getFileName("file"))
' File path
Dim filePath
filePath = load.getFilePath("file")
' File path complete
Dim filePathComplete
filePathComplete = load.getFilePathComplete("file")
' File size
Dim fileSize
fileSize = load.getFileSize("file")
' File size translated
Dim fileSizeTranslated
fileSizeTranslated = load.getFileSizeTranslated("file")
' Content Type
Dim contentType
contentType = load.getContentType("file")
' No. of Form elements
Dim countElements
countElements = load.Count
' Value of text input field "name"
Dim nameInput
nameInput = load.getValue("name")
' Path where file will be uploaded
Dim pathToFile
' pathToFile = Server.mapPath("uploaded/") & "\" & fileName
pathToFile = Server.mapPath("businesssearch/") & "\" & fileName
' Uploading file data
response.write "<br>hi112233"
response.write "<br> " & pathtofile
'response.end
Dim fileUploaded
fileUploaded = load.saveToFile ("file", pathToFile)
'response.write "<br>hi112233444"
'response.end
' destroying load object
Set load = Nothing
%>

<html>
<head>
<title>File Uploading with ASP</title>
<style>
body, input, td { font-family:verdana,arial; font-size:10pt; }
</style>
</head>
<body>
<p align="center">
<b>File Uploading with ASP</b><br>
<a href="show.asp">To see uploaded files click here</a>
</p>

<table width="700" border="1" align="center">
<tr>
<td>File Name</td><td><%= fileName %></td>
</tr><tr>
<td>File Path</td><td><%= filePath %></td>
</tr><tr>
<td>File Path Complete</td><td><%= filePathComplete %></td>
</tr><tr>
<td>File Size</td><td><%= fileSize %></td>
</tr><tr>
<td>File Size Translated</td><td><%= fileSizeTranslated %></td>
</tr><tr>
<td>Content Type</td><td><%= contentType %></td>
</tr><tr>
<td>No. of Form Elements</td><td><%= countElements %></td>
</tr><tr>
<td>Name</td><td><%= nameInput %></td>
</tr>
</table><br><br>

<p style="padding-left:220;">
<%
If fileUploaded = True Then
Response.Write fileName & " data uploaded..."
Else
Response.Write "<font color=""red"">File could not be uploaded..." Response.Write "</font>"
Response.Write "<br>Please select a file before hitting the
'Submit'"
Response.Write " button."
End If
%>
</p>

<br>
<table border="0" align="center">
<tr>
<form method="POST" enctype="multipart/form-data" action="Insert.asp"> <td>Name :</td><td>
<input type="text" name="name" size="40" value="<%= nameInput %>">
</td></tr>
<td>File :</td><td>
<input type="file" name="file" size="40"></td></tr>
<td> </td><td>
<input type="submit" value="Submit"></td></tr>
</form>
</tr>
</table>

</body>
</html>
loader.asp:

<%
' -- Loader.asp --
' -- version 1.5.2
' -- last updated 12/5/2002
'
' Faisal Khan
' fa****@stardeveloper.com
' www.stardeveloper.com
' Class for handling binary uploads

Class Loader
Private dict

Private Sub Class_Initialize
Set dict = Server.CreateObject("Scripting.Dictionary")
End Sub

Private Sub Class_Terminate
If IsObject(intDict) Then
intDict.RemoveAll
Set intDict = Nothing
End If
If IsObject(dict) Then
dict.RemoveAll
Set dict = Nothing
End If
End Sub

Public Property Get Count
Count = dict.Count
End Property

Public Sub Initialize
If Request.TotalBytes > 0 Then
Dim binData
binData = Request.BinaryRead(Request.TotalBytes)
getData binData
End If
End Sub

Public Function getFileData(name)
If dict.Exists(name) Then
getFileData = dict(name).Item("Value")
Else
getFileData = ""
End If
End Function

Public Function getValue(name)
Dim gv
If dict.Exists(name) Then
gv = CStr(dict(name).Item("Value"))

gv = Left(gv,Len(gv)-2)
getValue = gv
Else
getValue = ""
End If
End Function

Public Function saveToFile(name, path)
If dict.Exists(name) Then
Dim temp
temp = dict(name).Item("Value")
Dim fso
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Dim file
Set file = fso.CreateTextFile(path)
For tPoint = 1 to LenB(temp)
file.Write Chr(AscB(MidB(temp,tPoint,1)))
Next
file.Close
saveToFile = True
Else
saveToFile = False
End If
End Function

Public Function getFileName(name)
If dict.Exists(name) Then
Dim temp, tempPos
temp = dict(name).Item("FileName")
tempPos = 1 + InStrRev(temp, "\")
getFileName = Mid(temp, tempPos)
Else
getFileName = ""
End If
End Function

Public Function getFilePath(name)
If dict.Exists(name) Then
Dim temp, tempPos
temp = dict(name).Item("FileName")
tempPos = InStrRev(temp, "\")
getFilePath = Mid(temp, 1, tempPos)
Else
getFilePath = ""
End If
End Function

Public Function getFilePathComplete(name)
If dict.Exists(name) Then
getFilePathComplete = dict(name).Item("FileName")
Else
getFilePathComplete = ""
End If
End Function

Public Function getFileSize(name)
If dict.Exists(name) Then
getFileSize = LenB(dict(name).Item("Value"))
Else
getFileSize = 0
End If
End Function

Public Function getFileSizeTranslated(name)
If dict.Exists(name) Then
temp = LenB(dict(name).Item("Value"))
If temp <= 1024 Then
getFileSizeTranslated = temp & " bytes"
Else
temp = FormatNumber((temp / 1024), 2)
getFileSizeTranslated = temp & " kilobytes"
End If
Else
getFileSizeTranslated = ""
End If
End Function

Public Function getContentType(name)
If dict.Exists(name) Then
getContentType = dict(name).Item("ContentType")
Else
getContentType = ""
End If
End Function

Private Sub getData(rawData)
Dim separator
separator = MidB(rawData, 1, InstrB(1, rawData, ChrB(13)) - 1)

Dim lenSeparator
lenSeparator = LenB(separator)

Dim currentPos
currentPos = 1
Dim inStrByte
inStrByte = 1
Dim value, mValue
Dim tempValue
tempValue = ""

While inStrByte > 0
inStrByte = InStrB(currentPos, rawData, separator)
mValue = inStrByte - currentPos

If mValue > 1 Then
value = MidB(rawData, currentPos, mValue)

Dim begPos, endPos, midValue, nValue
Dim intDict
Set intDict = Server.CreateObject("Scripting.Dictionary")

begPos = 1 + InStrB(1, value, ChrB(34))
endPos = InStrB(begPos + 1, value, ChrB(34))
nValue = endPos

Dim nameN
nameN = MidB(value, begPos, endPos - begPos)

Dim nameValue, isValid
isValid = True

If InStrB(1, value, stringToByte("Content-Type")) > 1 Then

begPos = 1 + InStrB(endPos + 1, value, ChrB(34))
endPos = InStrB(begPos + 1, value, ChrB(34))

If endPos = 0 Then
endPos = begPos + 1
isValid = False
End If

midValue = MidB(value, begPos, endPos - begPos)
intDict.Add "FileName", trim(byteToString(midValue))

begPos = 14 + InStrB(endPos + 1, value,
stringToByte("Content-Type:"))
endPos = InStrB(begPos, value, ChrB(13))

midValue = MidB(value, begPos, endPos - begPos)
intDict.Add "ContentType", trim(byteToString(midValue))

begPos = endPos + 4
endPos = LenB(value)

nameValue = MidB(value, begPos, ((endPos - begPos) - 1))
Else
nameValue = trim(byteToString(MidB(value, nValue + 5)))
End If

If isValid = True Then

intDict.Add "Value", nameValue
intDict.Add "Name", nameN

dict.Add byteToString(nameN), intDict
End If
End If

currentPos = lenSeparator + inStrByte
Wend
End Sub

End Class

Private Function stringToByte(toConv)
Dim tempChar
For i = 1 to Len(toConv)
tempChar = Mid(toConv, i, 1)
stringToByte = stringToByte & chrB(AscB(tempChar))
Next
End Function

Private Function byteToString(toConv)
For i = 1 to LenB(toConv)
byteToString = byteToString & Chr(AscB(MidB(toConv,i,1)))
Next
End Function
%>

Jul 22 '05 #4
Actually, this setting (maxRequestLength) is done in the machine.config
file. Search your hard drive - mine is located in
C:\WINNT\Microsoft.NET\Framework\v1.1.4322\CONFIG

Bob Barrows
PS. In the future, could you leave microsoft.public.inetserver.asp.general
out of your crossposts for dotnet issues? That newsgroup is focussed on
classic ASP questions.

microsoft.public.scripting.vbscript is not really relevant either.
Scott Baxter wrote:
Thanks Mike. Where is this file? I tried putting a web.config file,
and it didn't do anything. I put it in the directory where the
insert.asp file is, and the target directory where I wrote it. Here
is the web.config I put there:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<httpRuntime
executionTimeout="300"
maxRequestLength="16384"
/>
</system.web>
</configuration>

Do I need to do a command to get my web site to recognize this? It
seemed to have no effect.

Thanks.

Scott


"Mike D" <Mi***@discussions.microsoft.com> wrote in message
news:11**********************************@microsof t.com...
If the server OS is 2003, that OS has a 200 KB upload limit. It can
be increased by editting the metabase.xml file.

MIke

"Scott Baxter" wrote:
Hello,

I got the following scripts to upload files to my directories

I call insert.htm

Browse for a file, then click 'submit'

It works for small files, and for a small .mdb (access file)

But for any larger file, it quits and give me 'page not found'

Is there some kind of timeout I can set?

Note: insert.htm calls insert.asp, call load.asp

Thanks:

Insert.asp:

<!-- insert.htm -->
<html>
<head>
<title>File Uploading with ASP</title>
<style>
body, input { font-family:verdana,arial; font-size:10pt; }
</style>
</head>
<body>
<p align="center">
<b>File Uploading with ASP</b><br>
<a href="show.asp">To see uploaded data click here</a>
</p>

<table border="0" align="center">
<tr>
<form method="POST" enctype="multipart/form-data"
action="Insert.asp"> <td>Name :</td><td>
<input type="text" name="name" size="40"></td></tr>
<td>File :</td><td>
<input type="file" name="file" size="40"></td></tr>
<td> </td><td>
<input type="submit" value="Submit"></td></tr>
</form>
</tr>
</table>

</body>
</html>
insert.asp:

<% ' Insert.asp %>
<!--#include file="Loader.asp"-->
<%

Response.Buffer = True

' load object
Dim load
Set load = new Loader

' calling initialize method
load.initialize
response.write "<br>hi1122"

' File binary data
Dim fileData
fileData = load.getFileData("file")
' File name
Dim fileName
fileName = LCase(load.getFileName("file"))
' File path
Dim filePath
filePath = load.getFilePath("file")
' File path complete
Dim filePathComplete
filePathComplete = load.getFilePathComplete("file")
' File size
Dim fileSize
fileSize = load.getFileSize("file")
' File size translated
Dim fileSizeTranslated
fileSizeTranslated = load.getFileSizeTranslated("file")
' Content Type
Dim contentType
contentType = load.getContentType("file")
' No. of Form elements
Dim countElements
countElements = load.Count
' Value of text input field "name"
Dim nameInput
nameInput = load.getValue("name")
' Path where file will be uploaded
Dim pathToFile
' pathToFile = Server.mapPath("uploaded/") & "\" & fileName
pathToFile = Server.mapPath("businesssearch/") & "\" & fileName
' Uploading file data
response.write "<br>hi112233"
response.write "<br> " & pathtofile
'response.end
Dim fileUploaded
fileUploaded = load.saveToFile ("file", pathToFile)
'response.write "<br>hi112233444"
'response.end
' destroying load object
Set load = Nothing
%>

<html>
<head>
<title>File Uploading with ASP</title>
<style>
body, input, td { font-family:verdana,arial; font-size:10pt; }
</style>
</head>
<body>
<p align="center">
<b>File Uploading with ASP</b><br>
<a href="show.asp">To see uploaded files click here</a>
</p>

<table width="700" border="1" align="center">
<tr>
<td>File Name</td><td><%= fileName %></td>
</tr><tr>
<td>File Path</td><td><%= filePath %></td>
</tr><tr>
<td>File Path Complete</td><td><%= filePathComplete %></td>
</tr><tr>
<td>File Size</td><td><%= fileSize %></td>
</tr><tr>
<td>File Size Translated</td><td><%= fileSizeTranslated
%></td> </tr><tr>
<td>Content Type</td><td><%= contentType %></td>
</tr><tr>
<td>No. of Form Elements</td><td><%= countElements %></td>
</tr><tr>
<td>Name</td><td><%= nameInput %></td>
</tr>
</table><br><br>

<p style="padding-left:220;">
<%
If fileUploaded = True Then
Response.Write fileName & " data uploaded..."
Else
Response.Write "<font color=""red"">File could not be
uploaded..." Response.Write "</font>"
Response.Write "<br>Please select a file before hitting the
'Submit'"
Response.Write " button."
End If
%>
</p>

<br>
<table border="0" align="center">
<tr>
<form method="POST" enctype="multipart/form-data"
action="Insert.asp"> <td>Name :</td><td>
<input type="text" name="name" size="40" value="<%= nameInput
%>"> </td></tr>
<td>File :</td><td>
<input type="file" name="file" size="40"></td></tr>
<td> </td><td>
<input type="submit" value="Submit"></td></tr>
</form>
</tr>
</table>

</body>
</html>
loader.asp:

<%
' -- Loader.asp --
' -- version 1.5.2
' -- last updated 12/5/2002
'
' Faisal Khan
' fa****@stardeveloper.com
' www.stardeveloper.com
' Class for handling binary uploads

Class Loader
Private dict

Private Sub Class_Initialize
Set dict = Server.CreateObject("Scripting.Dictionary")
End Sub

Private Sub Class_Terminate
If IsObject(intDict) Then
intDict.RemoveAll
Set intDict = Nothing
End If
If IsObject(dict) Then
dict.RemoveAll
Set dict = Nothing
End If
End Sub

Public Property Get Count
Count = dict.Count
End Property

Public Sub Initialize
If Request.TotalBytes > 0 Then
Dim binData
binData = Request.BinaryRead(Request.TotalBytes)
getData binData
End If
End Sub

Public Function getFileData(name)
If dict.Exists(name) Then
getFileData = dict(name).Item("Value")
Else
getFileData = ""
End If
End Function

Public Function getValue(name)
Dim gv
If dict.Exists(name) Then
gv = CStr(dict(name).Item("Value"))

gv = Left(gv,Len(gv)-2)
getValue = gv
Else
getValue = ""
End If
End Function

Public Function saveToFile(name, path)
If dict.Exists(name) Then
Dim temp
temp = dict(name).Item("Value")
Dim fso
Set fso =
Server.CreateObject("Scripting.FileSystemObject") Dim file
Set file = fso.CreateTextFile(path)
For tPoint = 1 to LenB(temp)
file.Write Chr(AscB(MidB(temp,tPoint,1)))
Next
file.Close
saveToFile = True
Else
saveToFile = False
End If
End Function

Public Function getFileName(name)
If dict.Exists(name) Then
Dim temp, tempPos
temp = dict(name).Item("FileName")
tempPos = 1 + InStrRev(temp, "\")
getFileName = Mid(temp, tempPos)
Else
getFileName = ""
End If
End Function

Public Function getFilePath(name)
If dict.Exists(name) Then
Dim temp, tempPos
temp = dict(name).Item("FileName")
tempPos = InStrRev(temp, "\")
getFilePath = Mid(temp, 1, tempPos)
Else
getFilePath = ""
End If
End Function

Public Function getFilePathComplete(name)
If dict.Exists(name) Then
getFilePathComplete = dict(name).Item("FileName")
Else
getFilePathComplete = ""
End If
End Function

Public Function getFileSize(name)
If dict.Exists(name) Then
getFileSize = LenB(dict(name).Item("Value"))
Else
getFileSize = 0
End If
End Function

Public Function getFileSizeTranslated(name)
If dict.Exists(name) Then
temp = LenB(dict(name).Item("Value"))
If temp <= 1024 Then
getFileSizeTranslated = temp & " bytes"
Else
temp = FormatNumber((temp / 1024), 2)
getFileSizeTranslated = temp & " kilobytes"
End If
Else
getFileSizeTranslated = ""
End If
End Function

Public Function getContentType(name)
If dict.Exists(name) Then
getContentType = dict(name).Item("ContentType")
Else
getContentType = ""
End If
End Function

Private Sub getData(rawData)
Dim separator
separator = MidB(rawData, 1, InstrB(1, rawData, ChrB(13)) - 1)

Dim lenSeparator
lenSeparator = LenB(separator)

Dim currentPos
currentPos = 1
Dim inStrByte
inStrByte = 1
Dim value, mValue
Dim tempValue
tempValue = ""

While inStrByte > 0
inStrByte = InStrB(currentPos, rawData, separator)
mValue = inStrByte - currentPos

If mValue > 1 Then
value = MidB(rawData, currentPos, mValue)

Dim begPos, endPos, midValue, nValue
Dim intDict
Set intDict = Server.CreateObject("Scripting.Dictionary")

begPos = 1 + InStrB(1, value, ChrB(34))
endPos = InStrB(begPos + 1, value, ChrB(34))
nValue = endPos

Dim nameN
nameN = MidB(value, begPos, endPos - begPos)

Dim nameValue, isValid
isValid = True

If InStrB(1, value, stringToByte("Content-Type")) > 1 Then

begPos = 1 + InStrB(endPos + 1, value, ChrB(34))
endPos = InStrB(begPos + 1, value, ChrB(34))

If endPos = 0 Then
endPos = begPos + 1
isValid = False
End If

midValue = MidB(value, begPos, endPos - begPos)
intDict.Add "FileName", trim(byteToString(midValue))

begPos = 14 + InStrB(endPos + 1, value,
stringToByte("Content-Type:"))
endPos = InStrB(begPos, value, ChrB(13))

midValue = MidB(value, begPos, endPos - begPos)
intDict.Add "ContentType",
trim(byteToString(midValue))

begPos = endPos + 4
endPos = LenB(value)

nameValue = MidB(value, begPos, ((endPos - begPos) - 1))
Else
nameValue = trim(byteToString(MidB(value, nValue + 5)))
End If

If isValid = True Then

intDict.Add "Value", nameValue
intDict.Add "Name", nameN

dict.Add byteToString(nameN), intDict
End If
End If

currentPos = lenSeparator + inStrByte
Wend
End Sub

End Class

Private Function stringToByte(toConv)
Dim tempChar
For i = 1 to Len(toConv)
tempChar = Mid(toConv, i, 1)
stringToByte = stringToByte & chrB(AscB(tempChar))
Next
End Function

Private Function byteToString(toConv)
For i = 1 to LenB(toConv)
byteToString = byteToString & Chr(AscB(MidB(toConv,i,1)))
Next
End Function
%>


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: jrefactors | last post by:
I posted this question before but no replied. I really need some suggestions. The JSP application is deployed in IBM Websphere, and it has file upload operation. The problem is if the user...
6
by: Russell Stevens | last post by:
I use a WinForm app for users to upload a file to my server. Basically one line of code; Response = WC.UploadData(MyUrl, "PUT", MyByteArray) Works fine except for larger files. After about 104...
4
by: UJ | last post by:
I have a page where the user can upload a video file. As you can guess, this may take a while. Is there a way I can change the session timeout for just this one page? I would also want to change...
9
by: 8anos | last post by:
Hello, I am new at the community and newbie at programming :) As you may know rapidshare provides a perl script for linux, to upload files at their servers. You can find the original scripts at...
8
by: michal | last post by:
hi guys, i was wondering how you deal with script timeouts caused by huge file uploads. Lets say I have a script timeout of 2 minutes and the user uploads a file which takes more than this ......
1
by: Mufasa | last post by:
Is there a way to set the timeouts for inactivity to be specific for a specific page? My memory is the answer is no. I have a script that is on every page at the moment that after twenty...
5
by: camphor | last post by:
hi, I have found an upload script in hotscripts and have implemented it into the website, I followed the installation steps to 'give write permissions to php on the upload folder (which is...
2
by: Piotrekk | last post by:
Hi I am trying to upload a 700 mb file using webrequest/response model. At 3x% I am getting the same error: "Unable to write data to the transport connection: an established connection was...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.