Error in classic asp String type mismatch - asp-classic

I keep getting this error
Microsoft VBScript runtime error '800a000d'
Type mismatch: '[string: ""]'
intHPrimary = rtrim(request.form("chkHPrimary"))
if len(intHPrimary) > 0 and isNumeric(intHPrimary) then
intHPrimary = cint(intHPrimary)
else
intHPrimary = 0
end if
<%if intHPrimary > 0 then%>---This is where I get my error
<input type="checkbox" name="chkHPrimary" value= "1" checked />
<%else%>
<input type="checkbox" name="chkHPrimary" value= "1" />
<%end if%></td>

A little bit of refactoring should help;
<%
Dim checked
Dim intHPrimary : intHPrimary = RTrim(Request.Form("chkHPrimary") & "")
If Len(intHPrimary) > 0 And IsNumeric(intHPrimary) Then intHPrimary = CInt(intHPrimary) Else intHPrimary = 0
If intHPrimary > 0 Then checked = " checked" Else checked = ""
%>
<input type="checkbox" name="chkHPrimary" value= "1"<%= checked %> /></td>
Try not to duplicate HTML when it is unnecessary and instead workout your logic and apply the result afterwards. Also, make sure that the code is inside ASP preprocessor tags <% %> or it will not be treated as code.

Related

save the checked items in checkbox to session

Need help. I want to save the items that are check in my checkbox to a Session.
What I'm doing is get the value of the items that are checked and store it in an array. Then I will assign that value as Session Name and assign a value of 1 to the session.
This is the code that I'm using but it only gets the first item that is checked.
dim checkboxList
checkboxList = request.Form("schedule")
checkboxList = split(checkboxList, ",")
for each i in checkboxList
Session(i) = 1
next
for example If I check A and B on my Checkbox I should get
Session("A")=1 and Session("B")=1
but the only thing i'm getting is Session("A")=1
I tried checking if I'm getting the right item on the my Array by Using this code and the data is correct.
dim checkboxList
checkboxList = request.Form("schedule")
checkboxList = split(checkboxList, ",")
for each i in checkboxList
response.write(i)
next
Here is my Html Code.
<form class="well" method="post" action="applicationSave.asp">
<div class="controls">
<input type="checkbox" id="onShifts" name="schedule" value="onShifts" <% if Session("onShifts") = 1 then response.Write("checked") end if %> /> On Shifts?<br>
<input type="checkbox" id="nightShifts" name="schedule" value="nightShifts" <% if Session("nightShifts") = 1 then response.Write("checked") end if %> /> Night Shifts?<br>
<input type="checkbox" id="partTime" name="schedule" value="partTime" <% if Session("partTime") = 1 then response.Write("checked") end if %> /> Part Time?<br>
<input type="checkbox" id="fullTime" name="schedule" value="fullTime" <% if Session("fullTime") = 1 then response.Write("checked") end if %> /> Full Time<br>
<input type="checkbox" id="holidays" name="schedule" value="holidays" <% if Session("holidays") = 1 then response.Write("checked") end if %> /> Holidays/Sundays?<br>
<input type="checkbox" id="projectBasis" name="schedule" value="projectBasis" <% if Session("projectBasis") = 1 then response.Write("checked") end if %> /> Project Basis
</div>
</form>
This is because values delimited with ", " (comma-space), instead "," only.
So, before working with array make "trimming" items:
Dim i
For i = 0 To UBound(checkboxList)
checkboxList(i) = Trim(checlboxList(i))
Next
Another way - write Session(Trim(i)) = 1 in for statement.
BTW: Commonly, your code is unsafe. E.g, you have some session bool variable Session("IsAuthorized"). Visitor can send request to your .asp file with value schedule=IsAuthorized...

Checkbox boolean value Classic ASP

I have a checkbox
<input type="checkbox" name="chkNGI" id="prod_ngi_sn" value="1">
When it is checked I pass the value 1, but when it is not checked any value is passed.
I have to pass the value 0.
I've tried
<input type="checkbox" name="chkNGI" id="prod_ngi_sn" <%if prod_ngi_sn.checked then value="1" else value="0" end if%>>
But didn't work.
tks
Checkboxes only pass values when ticked. You need logic on the server side to accommodate that.
Dim chkNGI
chkNGI = Request("chkNGI") & ""
If chkNGI = "" Then
chkNGI = "0"
End If
<script>
function calcParam() {
var checked = document.getElementById("prod_ngi_sn").checked;
if (checked)
document.getElementById("hiddenNGI").value = "1";
else
document.getElementById("hiddenNGI").value = "0"; }
</script>
<input type="hidden" name="chkNGI" id="hiddenNGI">
<input type="checkbox" name="checkNGI" id="prod_ngi_sn" onClick="calcParam()">
You can try this single line solution
Information: RS=Recordset Object
<input type="checkbox" <%If RS("ColumnName")=True Then Response.Write(" checked='checked' ")%> name="tableColumn" value="1" >
I know this question is old, but I recently had to refactor some legacy code for a company in Classic ASP, and ran into this problem. The existing code used a hidden form field with the same name as the checkbox and looked for either "false" or "false, true" in the results. It felt kludgy, but the code also performed actions based on dynamically named checkbox fields with prefixes, so inferring "false" from a missing field would introduce different complications.
If you want a checkbox to return either "0" or "1", this technique should do the trick. It uses an unnamed checkbox to manipulate a named hidden field.
<html>
<body>
<% If isempty(Request("example")) Then %>
<form>
<input type="hidden" name="example" value="0">
<input type="checkbox" onclick="example.value=example.value=='1'?'0':'1'">
<input type="submit" value="Go">
</form>
<% Else %>
<p>example=<%=Request("example")%></p>
<% End If %>
</body>
</html>
Create a hidden input with the name "chkNGI".
Rename your current checkbox to something different.
Add handled for onClick on the checkbox and using a small javascript function, depending on the state of the checkbox, write 0 or 1 in the hidden input.
As an example,
<script>
function calcParam() {
var checked = document.getElementById("prod_ngi_sn").checked;
if (checked)
document.getElementById("hiddenNGI").value = "1";
else
document.getElementById("hiddenNGI").value = "0";
}
</script>
<input type="hidden" name="chkNGI" id="hiddenNGI">
<input type="checkbox" name="checkNGI" id="prod_ngi_sn" onClick="calcParam()">
Your solution in post to saving page;
save.asp
<%
' connection string bla bla
' RS = Recordset Object
If Request.Form("tableColumn")=1 Then
RS("ColumnName") = 1
Else
RS("ColumnName") = 0
End If
' other columns saving process bla bla bla
%>

classic asp to asp.net conversion

hi i am working on project jigsaw puzzle game . i have done with coding in classic asp using vb script and it working properly . i want to do same coding asp.net using vb.net but css style i was written it was not working properly in asp.net can anybody help me doing this conversion.
<html>
<head>
<script type="text/javascript">
function setText(pieceID)
{
if (document.getElementById("first").value == '' )
{
document.getElementById("first").value=pieceID;
}
else
{
document.getElementById("second").value=pieceID;
document.swap.submit();
}
}
</script>
</head>
<body>
<%
dim img
img = "img1.jpg"
%>
<div class="classname"> <img src="<%response.write img%>"> </div>
<%dim imgPIX
imgPIX = 60
%>
<style>
.icons { display: block; width: <%response.write imgPIX%>px; height: <%response.write imgPIX%>px; background-image: url(<%response.write img%>); background-repeat: no-repeat; }
<%
dim proper
dim ico_number,col
dim row_number,rw
for row_number = 1 to 6
rw = (row_number - 1) * (-1 * imgPIX)
for ico_number = 1 to 6
col = (ico_number - 1) *(-1 * imgPIX)
response.write ".icon"& row_number &"_"& ico_number &" { background-position: col &"px "& rw &"px; } "
if not proper = "" then
proper = proper & "," & row_number &"_"& ico_number
else
proper = row_number &"_"& ico_number
end if
response.write ".icon"& row_number &"_"& ico_number &" { background-position: 0px 0px; } "
next
next
%>
</style>
<%
dim userfeed
if request.form("userform") = "" then
userfeed = random_sort(proper)
end if
if request.form("first") <> "" and request.form("second") <> "" then
userfeed = request.form("userform")
userfeed = replace(userfeed,request.form("first"),"temp1")
userfeed = replace(userfeed,request.form("second"),"temp2")
userfeed = replace(userfeed,"temp1",request.form("second"))
userfeed = replace(userfeed,"temp2",request.form("first"))
end if
%>
<center>
<form name="swap" action="default.asp" method="post">
<input type="hidden" name="first" ID="first">
<input type="hidden" name="second" ID="second">
<input type="hidden" name="userform" ID="userform" value="<%response.write userfeed%>">
</form>
<table border="0">
<%
if userfeed = proper then
%>
<H1>Solved !!</h1>
<%
end if
dim icoarr
icoarr = split(userfeed,",")
dim ctr
ctr =0
for each piece in icoarr
if ctr =6 then
response.write "<tr>"
end if
%>
<td><span class="icons icon<%response.write piece%>" style="float:left;" onclick="setText('<%response.write piece%>')"></span></td>
<%
if ctr =6 then
ctr =1
else
ctr = ctr + 1
end if
next
%>
<%public function random_sort(arrySTR)
arrySTR = arrySTR & ","
dim retstr
do while arrySTR <> ""
dim arr
arr = split(arrySTR,",")
dim random_number
randomize
random_number=int(rnd*(ubound(arr)-1))+0
'response.write random_number
retstr =arr(random_number) & "," & retstr
arrySTR = replace(arrySTR,arr(random_number) & ",","")
loop
retstr = mid(retstr,1,len(retstr)-1)
'response.write "<br>" & retstr
random_sort=retstr
end function
%>
</table>
</body>
You can try Asp.Net WEBMATRIX tool for converting the same code to Asp.Net with minimal effort
http://www.asp.net/web-pages

Multiple Uploads

hey I need the help with the following.
I have a website,
altough I was not a 100% programmer, I am trying to navigate within the programming of the site. It work in asp.net 2.0.
I have an image gallery, but the only problem is that I can only upload 1 image at a time. I need some help how i can integrate multiple images on the site.
below is the coding for album.asp
<%#LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!-- #INCLUDE file="inc/settings.asp" -->
<!-- #INCLUDE file="inc/functions.asp" -->
<!-- #INCLUDE file="inc/db_connect.asp" -->
<!-- #INCLUDE file="inc/check_login.asp" -->
<!--#INCLUDE file="fckeditor/fckeditor.asp" -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" src="js/script.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Xaghra Scouts</title>
<link href="styles.css" rel="stylesheet" type="text/css" />
<%
cat = decrypt(request("cat") & "")
set fs=Server.CreateObject("Scripting.FileSystemObject")
isSub = true
%>
</head>
<body>
<!-- #INCLUDE file="layout_top.asp" -->
<%if loggedin then%>
<table align="center" border="0" cellspacing="0" cellpadding="5" class="main">
<tr >
<td align="center" style="padding:15px;" colspan="2">
<form action="album.asp" method="post" id="selectCategory">
<b>SELECT CATEGORY: </b>
<select name="cat" style="font-size:12px; width:160px; height:19px;" onChange="javascript: document.getElementById('selectCategory').submit();">
<option selected>Uncategorized</option>
<%
set fo=fs.GetFolder(Server.MapPath("images/gallery"))
for each x in fo.SubFolders
Response.write("<option value='" & encrypt(x.Name) & "'")
if cat = x.Name then
response.write("selected")
end if
Response.write(">" & x.Name & "</option>")
next
%>
</select>
</form>
</td>
</tr>
<tr style="color:#666666; font-size:12px;">
<td colspan="2" align="left">
<br>
<%
if cat <> "" and fs.FolderExists(Server.MapPath("images/gallery/" & cat)) then
set fo=fs.GetFolder(Server.MapPath("images/gallery/" & cat))
path = "gallery/" & cat
else
set fo=fs.GetFolder(Server.MapPath("images/gallery"))
path = "gallery"
end if
for each file in fo.files
if right(lcase(file.Name),3) = "jpg" then%>
<div style="height:120px; width:160px; text-align:center; float:left;"><img src="thumbnail.aspx?picture=<%=server.URLEncode("images/" & path & "/" & file.Name)%>&maxWidth=160&maxHeight=100" style="border:1px solid #ffffff;"><br>
<a onClick="javascript:ConfirmChoice('Are you sure you wish to delete this picture?','delete_image.asp?cat=<%=encrypt(cat)%>&file=<%=Server.URLEncode("images/" & path & "/" & file.Name)%>');"href="#" style="font-size:10px">DELETE</a></div>
<%end if
next
%>
</tr>
<tr style="color:#666666; font-size:12px;">
<td colspan="2" align="left">
<div style="text-align:center;">
<form action="file_upload.asp?FileName=<%=Server.URLEncode(uniqueName())%>&FilePath=<%=Server.URLEncode("images/" & path)%>&AcceptedFiles=<%=Server.URLEncode("JPG")%>&Redirect=<%=Server.URLEncode("album.asp")%>&MaxHeight=480&MaxWidth=640" enctype="multipart/form-data" method="post">
<table align="center" border="0" cellspacing="0" cellpadding="20" class="main">
<tr>
<td align="center" class="details">
<div style="color:#FF0000; font-size:10px;"><%if (request.QueryString("formatError") & "") <> "" then%>INVALID FILE FORMAT ( .JPG ONLY )<%end if%> </div><br>
<input name="file" type="file" accept="jpg/jpeg" class="input"> <input name="upload" value="Upload" type="submit" ></td>
</tr>
</table>
</form>
</div>
<br>
</td>
</tr>
<tr style="font-size:12px;">
<td class="list_title" align="center" style="padding:15px;">
<form action="add_category.asp" method="post" id="addCategory">
<span><b>NEW CATEGORY:</b></span>
<input name="cat" type="text" style="width:140; font-size:12px;">
<input name="" type="submit" value="ADD" style="font-size:10px;">
</form>
</td>
<td class="list_title" align="center" style="padding:15px;">
<form action="delete_category.asp" method="post" id="deleteCategory">
<span><b>DELETE CATEGORY: </b></span>
<select name="cat" style="font-size:12px; width:130px; height:19px;">
<option selected>-- select --</option>
<%
set fo=fs.GetFolder(Server.MapPath("images/gallery"))
for each x in fo.SubFolders
Response.write("<option value='" & x.Name & "'>" & x.Name & "</option>")
next
%>
</select>
<input type="button" value="REMOVE" style="font-size:10px;" onClick="javascript:ConfirmFormChoice('Are you sure you wish to delete this category and all of its contents?','deleteCategory');">
</form>
</td>
</tr>
</table>
<%else%>
<table width="700" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="center" style="padding-left:30px">
<div style="float:none;">
<%if cat <> "" and fs.FolderExists(Server.MapPath("images/gallery/" & cat)) then
set fo=fs.GetFolder(Server.MapPath("images/gallery/" & cat))
path = "images/gallery/" & cat
else
set fo=fs.GetFolder(Server.MapPath("images/gallery"))
path = "images/gallery"
end if
for each folder in fo.subfolders ' display categorises
isSub = false%>
<a href="album.asp?cat=<%=encrypt(folder.Name)%>" style="text-decoration:none; cursor:pointer;">
<div class="text" style="width:90px; height:120px;background-image:url(images/layout/folder.jpg); background-repeat:no-repeat; float:left; text-align:center;"><br /><br />
<%set fi=fs.GetFolder(Server.MapPath("images/gallery/" & folder.Name))
for each file in fi.files
if right(lcase(file.Name),3) = "jpg" then%>
<br><img src="thumbnail.aspx?picture=<%=server.URLEncode("images/gallery/" & folder.Name & "/" & file.Name)%>&maxWidth=40&maxHeight=30" style="border:1px solid #ffffff; cursor:default;" /><%
exit for
end if
next
%><br><br><span style="font-size:9px; font-weight:normal; color:#000"><%=folder.Name%></span></div>
</a>
<%next%>
</div>
</td>
</tr>
<tr>
<td align="center" style="padding-left:30px;">
<br />
<hr noshade="noshade" size="1px" color="#ffb883" width="400px" />
<%for each file in fo.files ' display uncategorized pics
if right(lcase(file.Name),3) = "jpg" then%>
<a href="thumbnail.aspx?picture=<%=server.URLEncode(path & "/" & file.Name)%>&maxWidth=640&maxHeight=480" target="_blank" style="text-decoration:none; cursor:pointer;">
<img src="thumbnail.aspx?picture=<%=server.URLEncode(path & "/" & file.Name)%>&maxWidth=160&maxHeight=100" style="border:1px solid #ffffff; margin:5px; margin-top:14px;">
</a>
<%end if
next%>
<br /><br />
<%if isSub then%>
<hr noshade="noshade" size="1px" color="#ffb883" width="400px" />
<div align="center" style="padding-left:20px;">BACK TO MAIN ALBUM</div>
<%end if%>
</td>
</tr>
</table>
<%end if%>
<!-- #INCLUDE file="layout_bottom.asp" -->
</body>
</html>
BELOW IS THE CODING FOR FILE_UPLOAD.ASP
<%
Option Explicit
' used to track various positions
dim PosB, PosBBound, PosEBound, PosEHead, PosBFld, PosEFld
' these handle the data
dim Boundary, BBoundary, PartBHeader, PartAHeader, PartContent, PartContent2, Binary
' for writing and converting
dim fso, fle, rst, DataString, FileName
' various other
dim I, Length, ContType, PartName, LastPart, BCrlf, PartContentLength
dim MaxWidth, MaxHeight, NewFileName, FilePath, AcceptedFiles, Redirect, Extension, SavedFileName, Image, NewHeight, otherExtension
Session.Timeout = 30
'Allow 300 seconds for file to upload
Server.ScriptTimeout = 300
MaxWidth = CINT(Request.QueryString("MaxWidth"))
MaxHeight = CINT(Request.QueryString("MaxHeight"))
NewFileName = Request.QueryString("FileName")
FilePath = Request.QueryString("FilePath")
AcceptedFiles = Request.QueryString("AcceptedFiles")
Redirect = Request.QueryString("Redirect")
' ado constants
const adLongVarBinary = 205
const adLongVarchar = 201
' must be submitted using POST
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
ContType = Request.ServerVariables("HTTP_Content_Type")
' must be "multipart/form-data"
If LCase(Left(ContType, 19)) = "multipart/form-data" Then
PosB = InStr(LCase(ContType), "boundary=") 'get boundary
If PosB > 0 Then Boundary = Mid(ContType, PosB + 9) 'we have one
'bugfix IE5.01 - double header
PosB = InStr(LCase(ContType), "boundary=")
If PosB > 0 then
PosB = InStr(Boundary, ",")
If PosB > 0 Then Boundary = Left(Boundary, PosB - 1)
End If
Length = CLng(Request.ServerVariables("HTTP_Content_Length")) 'Get Content-Length header
End If
If Length > 0 And Boundary <> "" Then
Boundary = "--" & Boundary
' get request, binary
Binary = Request.BinaryRead(Length)
' convert boundry to binary
For I=1 to len(Boundary)
BBoundary = BBoundary & ChrB(Asc(Mid(Boundary,I,1)))
Next
' binary crlf
BCrlf = ChrB(Asc(vbCr)) & ChrB(Asc(vbLf))
' get begin and end of first boundary
PosBBound = InStrB(Binary, BBoundary)
PosEBound = InStrB(PosBBound + LenB(BBoundary), Binary, BBoundary, 0)
' keep doing until we had them all
Do While (PosBBound > 0 And PosEBound > 0)
' get position of the end of the header
PosEHead = InStrB(PosBBound + LenB(BBoundary), Binary, BCrlf & BCrlf)
' get content of header and convert to string
PartBHeader = MidB(Binary, PosBBound + LenB(BBoundary) + 2, PosEHead - PosBBound - LenB(BBoundary) - 2)
PartAHeader = ""
For I=1 to lenb(PartBHeader)
PartAHeader = PartAHeader & Chr(AscB(MidB(PartBHeader,I,1)))
Next
' make sure we end it with ;
If Right(PartAHeader,1) <> ";" Then PartAHeader = PartAHeader & ";"
' get content of this part
PartContent = MidB(Binary, PosEHead + 4, PosEBound - (PosEHead + 4) - 2)
' get name of part
PosBFld = Instr(lcase(PartAHeader),"name=")
If PosBFld > 0 Then
' name found
PosEFld = Instr(PosBFld,lcase(PartAHeader),";")
If PosEFld > 0 Then
' well-formed name header
PartName = Mid(PartAHeader,PosBFld+5,PosEFld-PosBFld-5)
End If
' chop of leading and trailing "'s
Do Until Left(PartName,1) <> """"
PartName = Mid(PartName,2)
Loop
Do Until Right(PartName,1) <> """"
PartName = Left(PartName,Len(PartName)-1)
Loop
End If
' get file name of part (if any)
PosBFld = Instr(lcase(PartAHeader),"filename=""")
If PosBFld > 0 Then
' content header found
PosEFld = Instr(PosBFld + 10,lcase(PartAHeader),"""")
If PosEFld > 0 Then
' well-formed content header
FileName = Mid(PartAHeader,PosBFld+10,PosEFld-PosBFld-10)
End If
' chop of leading and trailing "'s
Do Until Left(FileName,1) <> """"
FileName = Mid(FileName,2)
Loop
Do Until Right(FileName,1) <> """"
FileName = Left(FileName,Len(FileName)-1)
Loop
Else
FileName = ""
End If
' ikkonverti minn binary ghal data regolari
' at the end, datastring will contain 'readable' data
' is this wide-byte binary data?
if vartype(PartContent) = 8 then
' need to do some conversion
Set rst = CreateObject("ADODB.Recordset")
PartContentLength = LenB(PartContent)
if PartContentLength > 0 then
' data, so add to recordset to speed up conversion
rst.Fields.Append "data", adLongVarBinary, PartContentLength
rst.Open
rst.AddNew
rst("data").AppendChunk PartContent & ChrB(0)
rst.Update
PartContent2 = rst("data").GetChunk(PartContentLength)
rst.close
set rst = nothing
else
' no data?
PartContent2 = ChrB(0)
End If
Else
' no need for conversion
PartContent2 = PartContent
End If
PartContentLength = LenB(PartContent2)
if PartContentLength > 0 then
' we have data to convert
Set rst = CreateObject("ADODB.Recordset")
rst.Fields.Append "data", adLongVarChar, PartContentLength
rst.Open
rst.AddNew
rst("data").AppendChunk PartContent2
rst.Update
DataString = rst("data")
rst.close
set rst = nothing
Else
' nothing to convert
dataString = ""
End If
' conversion has been done, now what to do with it
If FileName <> "" Then
' we have a file, let's save it to disk
FileName = Mid(Filename,InstrRev(FileName,"\")+1)
Extension = UCASE(Mid(Filename,InstrRev(FileName,".")+1))
' response.Write(Extension)
IF AcceptedFiles <> "" THEN
'Check if file is acceptable
IF INSTR(1, UCASE(AcceptedFiles), Extension) = 0 THEN
Response.redirect(redirect & "&formatError=true")
Response.End
End If
End IF
If NewFileName = "" THEN
'l-isem tal-file jibqa l-istess / differend extension
NewFileName = replace(lcase(FileName),"." & lcase(extension),".jpg")
END IF
' response.Write(NewFileName)
' response.end
IF FilePath <> "" THEN
IF RIGHT(FilePath,1) <> "\" THEN Filepath = FilePath & "\"
END IF
SavedFileName = FilePath & NewFileName
' response.Write(savedfilename)
' iftah il-file (textstream)
set fso = Server.CreateObject("Scripting.Filesystemobject")
set fle = fso.CreateTextFile(Server.MapPath(SavedFileName & "." & lcase(extension)))
' write the data
fle.write DataString
fle.close
' cleanup
set fle = nothing
set fso = nothing
End If
'remove other type of file if exists--------------------
' if lcase(extension) = "jpg" then
' otherExtension = "pdf"
' elseif lcase(extension) = "pdf" then
' otherExtension = "jpg"
' end if
'
' dim fs
' dim f
' set fs=Server.CreateObject("Scripting.FileSystemObject")
' if fs.FileExists(Server.MapPath(SavedFileName & "." & otherExtension))=true then
' set f=fs.GetFile(Server.MapPath(SavedFileName & "." & otherExtension))
' f.delete
' end if
'
' set fs = nothing
' set f = nothing
'------------------------------
LastPart = MidB(Binary, PosEBound + LenB(BBoundary), 2)
If LastPart = ChrB(Asc("-")) & ChrB(Asc("-")) Then
' don't look for others
PosBBound = 0
PosEBound = 0
ELSE
' look for others
PosBBound = PosEBound
PosEBound = InStrB(PosBBound + LenB(BBoundary), Binary, BBoundary)
End If
loop
ELSE
' Response.Write "<P>Invalid or empty request, no fields processed. Make sure that the content type is multipart/form-data"
Response.End
End If
ELSE
' Response.Write "<P>Form must be submitted using the POST method"
Response.End
End If
'Response.Write "<BR>Execution ended: " & Now & "<BR>"
'Response.Write "Filename = " & SavedFileName & "<BR>"
'Response.Write "MaxWidth = " & MaxWidth & "<BR>"
'Response.Write "MaxHeight = " & MaxHeight & "<BR>"
'///Biddel id-daqs tal-istampa jekk tkun akbar minn kemm suppost///
'IF MaxHeight > 0 AND MaxWidth > 0 THEN
' Set Image = Server.CreateObject("csImageFile.Manage")
' Image.ReadFile Server.MapPath(SavedFileName)
' IF Image.Height > MaxHeight OR Image.Width > MaxWidth THEN
' NewHeight = ((Image.Height/Image.Width) * MaxWidth)
' IF NewHeight > MaxHeight THEN
' 'Resizing Based On Height
' Image.Resize 0, MaxHeight
' ELSE
' 'Resizing Based On Width
' Image.Resize MaxWidth, 0
' End If
' Image.JpegQuality = 85
' Image.WriteFile Server.MapPath(SavedFileName)
' End If
' Image.HasFileInfo = False
' Set Image = Nothing
'END IF
'\\\\\\\\\\\\\\\\\\\\\\
IF Redirect <> "" AND lcase(extension) = "jpg" AND MaxWidth > 0 AND MaxHeight > 0 THEN
Response.redirect "resize_picture.aspx?Picture=" & server.URLEncode(Server.MapPath(SavedFileName)) & "." & lcase(extension) & "&MaxWidth=" & server.URLEncode(maxWidth) & "&maxHeight=" & server.URLEncode(maxHeight) & "&Redirectto=" & server.URLEncode(Redirect)
ELSEIF Redirect <> "" THEN
Response.redirect(redirect)
END IF
%>
CAN ANYONE HELP ME INTEGRATE MULTIPLE UPLOADS IN THE ABOVE MENTIONED FRAMEWORK :) ?
Perhaps a Flash-based upload tool would work better. Many sites that support multiple uploads on a single page are moving to this kind of solution.
Here are a couple that a Google search unearthed:
Multiple File Upload With Progress Bar Using Flash and ASP.NET
MultiPowUpload
FYI, these pages are classic ASP and unrelated to the more recently introduced ASP.NET technology.
I don't know how to fix your problem, but a long, long time ago, I've used the commercially available SoftArtisans FileUp component to allow reliable multi-file uploads in classic ASP.
Did you try using multiple <input type="file"> 's?
EDIT:
What you might try also then, is dynamically creating an IFRAME with the file input field in it and submit that form, holding the file in a temporary location on the server and somehow indicating to the user that they have uploaded one of the files.

ASP (VBscript) radio buttons not returning value

I have 2 very simple pages, an HTML page and a classic ASP page .. the html page has a form which calls (and sends) the data to the ASP form (which then prints out the data)
The problem is I'm not getting the value of the radio button, I'm simply just getting "on".
Here is the html:
<form action="form.asp" method="post">
<strong>Gender:</strong>
<input type="radio" value"male" name="gender">Man
<input type="radio" value"female" name="gender">Woman<p></p>
<strong>Size:</strong>
<input type="text" width="20" name="size" size="4"><p></p>
<strong>Color:</strong>
<select size="1" name="color">
<option>blue</option>
<option>green</option>
<option>black</option>
</select><p></p>
<input type="submit" value="Send Order">
</form>
and here is the ASP
<%
Dim strgen, strsize, strcol
strgen = Request.form("gender")
intsize = Request.form("size")
strcol = Request.form("color")
Response.write "Your gender: " & strgen & "<br />"
Response.write "Your size: " & intsize & "<br />"
Response.write "The color you ordered: " & strcol & "<br />"
%>
Like I said, all I'm getting for "strgen" is "on" ...
There's typos in your code, missing equals sign.
value"male"
should be
value="male"
Because the value was ignored it was returning the default value of "on"
Try using an html validator as www.htmlvalidator.com. This site offers a free one which is good (I'm using the professional version myself).
This will find such types immediatly (and will save you countless hours of searching).

Resources