Get ready for BLACK FRIDAY shopping starting in

Forums

ASP

This topic is locked

Pure ASP Upload

Posted 05 May 2005 20:19:34
1
has voted
05 May 2005 20:19:34 Arturo Civit posted:
hi there, this is my first post, ( I´m not an expert with ASP files ), I've a problem with this extension and I don´t have a clue of what's happening, I've an ASP document with the add record behavior, also I've the Pure ASP Upload extension working with a file field, this document works fine in my local machine, but when I upload the file to the server this is what I got:

Microsoft VBScript runtime error '800a000d'

Type mismatch: 'LBound'

/multimax/admin/agregafresnillo.asp, line 127

the line 127 is this:

For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2


and I don't know what's going on, the entire code in my documents is this:


Can someone help me please?

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="../Connections/CinemaxSite.asp" -->
<!--#include file="../ScriptLibrary/incPureUpload.asp" -->
<%
'*** Pure ASP File Upload -----------------------------------------------------
' Copyright (c) 2001-2002 George Petrov, www.UDzone.com
' Process the upload
' Version: 2.0.9
'------------------------------------------------------------------------------
'*** File Upload to: """../cartelera""", Extensions: "GIF,JPG,JPEG,BMP,PNG", Form: nuevacartelera, Redirect: "", "file", "", "over", "true", "", "" , "", "", "", "", "600", "", "", ""

Dim GP_redirectPage, RequestBin, UploadQueryString, GP_uploadAction, UploadRequest
PureUploadSetup

If (CStr(Request.QueryString("GP_upload") <> "" Then
on error resume next
Dim reqPureUploadVersion, foundPureUploadVersion
reqPureUploadVersion = 2.09
foundPureUploadVersion = getPureUploadVersion()
if err or reqPureUploadVersion > foundPureUploadVersion then
Response.Write "<b>You don't have latest version of ScriptLibrary/incPureUpload.asp uploaded on the server.</b><br>"
Response.Write "This library is required for the current page. It is fully backwards compatible so old pages will work as well.<br>"
Response.End
end if
on error goto 0
GP_redirectPage = ""
Server.ScriptTimeout = 600

RequestBin = Request.BinaryRead(Request.TotalBytes)
Set UploadRequest = CreateObject("Scripting.Dictionary"
BuildUploadRequest RequestBin, """../cartelera""", "file", "", "over"

If (GP_redirectPage <> "" and not (CStr(UploadFormRequest("MM_insert") <> "" or CStr(UploadFormRequest("MM_update") <> "") Then
If (InStr(1, GP_redirectPage, "?", vbTextCompare) = 0 And UploadQueryString <> "" Then
GP_redirectPage = GP_redirectPage & "?" & UploadQueryString
End If
Response.Redirect(GP_redirectPage)
end if
else
if UploadQueryString <> "" then
UploadQueryString = UploadQueryString & "&GP_upload=true"
else
UploadQueryString = "GP_upload=true"
end if
end if
' End Pure Upload
'------------------------------------------------------------------------------
%>
<%
' *** Edit Operations: (Modified for File Upload) declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME")
If (UploadQueryString <> "" Then
MM_editAction = MM_editAction & "?" & Server.HTMLEncode(UploadQueryString)
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: (Modified for File Upload) set variables

If (CStr(UploadFormRequest("MM_insert") = "nuevacartelera" Then

MM_editConnection = MM_CinemaxSite_STRING
MM_editTable = "Fresnillo"
MM_editRedirectUrl = "checkdata.asp"
MM_fieldsStr = "NombreSpanish2|value|NombreEnglish2|value|Clasificacion2|value|Pais2|value|FechaRelease2|value|Director2|value|Reparto2|value|SitioOficial2|value|SalasExhibicion2|value|Horarios2|value|Imagen2|value|textarea|value"
MM_columnsStr = "NombreSpanish|',none,''|NombreEnglish|',none,''|Clasificacion|',none,''|Pais|',none,''|FechaRelease|',none,''|Director|',none,''|Reparto|',none,''|SitioOficial|',none,''|SalasExhibicion|',none,''|Horarios|',none,''|Imagen|',none,''|Sinopsis|',none,''"

' create the MM_fields and MM_columns arrays
MM_fields = Split(MM_fieldsStr, "|"
MM_columns = Split(MM_columnsStr, "|"

' set the form values
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_fields(MM_i+1) = CStr(UploadFormRequest(MM_fields(MM_i)))
Next

' append the query string to the redirect URL
If (MM_editRedirectUrl <> "" And UploadQueryString <> "" Then
If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And UploadQueryString <> "" Then
MM_editRedirectUrl = MM_editRedirectUrl & "?" & UploadQueryString
Else
MM_editRedirectUrl = MM_editRedirectUrl & "&" & UploadQueryString
End If
End If

End If
%>
<%
' *** Insert Record: (Modified for File Upload) construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(UploadFormRequest("MM_insert") <> "" Then

' create the sql insert statement
MM_tableValues = ""
MM_dbValues = ""
For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
MM_formVal = MM_fields(MM_i+1)
MM_typeArray = Split(MM_columns(MM_i+1),","
MM_delim = MM_typeArray(0)
If (MM_delim = "none" Then MM_delim = ""
MM_altVal = MM_typeArray(1)
If (MM_altVal = "none" Then MM_altVal = ""
MM_emptyVal = MM_typeArray(2)
If (MM_emptyVal = "none" Then MM_emptyVal = ""
If (MM_formVal = "" Then
MM_formVal = MM_emptyVal
Else
If (MM_altVal <> "" Then
MM_formVal = MM_altVal
ElseIf (MM_delim = "'" Then ' escape quotes
MM_formVal = "'" & Replace(MM_formVal,"'","''" & "'"
Else
MM_formVal = MM_delim + MM_formVal + MM_delim
End If
End If
If (MM_i <> LBound(MM_fields)) Then
MM_tableValues = MM_tableValues & ","
MM_dbValues = MM_dbValues & ","
End If
MM_tableValues = MM_tableValues & MM_columns(MM_i)
MM_dbValues = MM_dbValues & MM_formVal
Next
MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & " values (" & MM_dbValues & ""

If (Not MM_abortEdit) Then
' execute the insert
Set MM_editCmd = Server.CreateObject("ADODB.Command"
MM_editCmd.ActiveConnection = MM_editConnection
MM_editCmd.CommandText = MM_editQuery
MM_editCmd.Execute
MM_editCmd.ActiveConnection.Close

If (MM_editRedirectUrl <> "" Then
Response.Redirect(MM_editRedirectUrl)
End If
End If

End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset"
Recordset1.ActiveConnection = MM_CinemaxSite_STRING
Recordset1.Source = "SELECT * FROM Fresnillo"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script language="JavaScript">
<!--

function checkFileUpload(form,extensions,requireUpload,sizeLimit,minWidth,minHeight,maxWidth,maxHeight,saveWidth,saveHeight) { //v2.09
document.MM_returnValue = true;
for (var i = 0; i<form.elements.length; i++) {
field = form.elements[i];
if (field.type.toUpperCase() != 'FILE') continue;
checkOneFileUpload(field,extensions,requireUpload,sizeLimit,minWidth,minHeight,maxWidth,maxHeight,saveWidth,saveHeight);
} }

function checkOneFileUpload(field,extensions,requireUpload,sizeLimit,minWidth,minHeight,maxWidth,maxHeight,saveWidth,saveHeight) { //v2.09
document.MM_returnValue = true;
if (extensions != '') var re = new RegExp("\.(" + extensions.replace(/,/gi,"|".replace(/\s/gi,"" + "$","i";
if (field.value == '') {
if (requireUpload) {alert('File is required!');document.MM_returnValue = false;field.focus();return;}
} else {
if(extensions != '' && !re.test(field.value)) {
alert('This file type is not allowed for uploading.\nOnly the following file extensions are allowed: ' + extensions + '.\nPlease select another file and try again.');
document.MM_returnValue = false;field.focus();return;
}
document.PU_uploadForm = field.form;
re = new RegExp(".(gif|jpg|png|bmp|jpeg)$","i";
if(re.test(field.value) && (sizeLimit != '' || minWidth != '' || minHeight != '' || maxWidth != '' || maxHeight != '' || saveWidth != '' || saveHeight != '')) {
checkImageDimensions(field,sizeLimit,minWidth,minHeight,maxWidth,maxHeight,saveWidth,saveHeight);
} }
}

function showImageDimensions(fieldImg) { //v2.09
var isNS6 = (!document.all && document.getElementById ? true : false);
var img = (fieldImg && !isNS6 ? fieldImg : this);
if (img.width > 0 && img.height > 0) {
if ((img.minWidth != '' && img.minWidth > img.width) || (img.minHeight != '' && img.minHeight > img.height)) {
alert('Uploaded Image is too small!\nShould be at least ' + img.minWidth + ' x ' + img.minHeight); return;}
if ((img.maxWidth != '' && img.width > img.maxWidth) || (img.maxHeight != '' && img.height > img.maxHeight)) {
alert('Uploaded Image is too big!\nShould be max ' + img.maxWidth + ' x ' + img.maxHeight); return;}
if (img.sizeLimit != '' && img.fileSize > img.sizeLimit) {
alert('Uploaded Image File Size is too big!\nShould be max ' + (img.sizeLimit/1024) + ' KBytes'); return;}
if (img.saveWidth != '') document.PU_uploadForm[img.saveWidth].value = img.width;
if (img.saveHeight != '') document.PU_uploadForm[img.saveHeight].value = img.height;
document.MM_returnValue = true;
} }

function checkImageDimensions(field,sizeL,minW,minH,maxW,maxH,saveW,saveH) { //v2.09
if (!document.layers) {
var isNS6 = (!document.all && document.getElementById ? true : false);
document.MM_returnValue = false; var imgURL = 'file:///' + field.value.replace(/\\/gi,'/').replace(/:/gi,'|').replace(/"/gi,'').replace(/^\//,'');
if (!field.gp_img || (field.gp_img && field.gp_img.src != imgURL) || isNS6) {field.gp_img = new Image();
with (field) {gp_img.sizeLimit = sizeL*1024; gp_img.minWidth = minW; gp_img.minHeight = minH; gp_img.maxWidth = maxW; gp_img.maxHeight = maxH;
gp_img.saveWidth = saveW; gp_img.saveHeight = saveH; gp_img.onload = showImageDimensions; gp_img.src = imgURL; }
} else showImageDimensions(field.gp_img);}
}
//-->
</script>
<title>.: Administrador MultiMax :. .: Agregar cartelera :.</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
background-image: url(images/fondo.jpg);
}
.style16 {color: #bdac6d; font-family: Arial, Helvetica, sans-serif; font-size: 14px; font-weight: bold; }
.style8 {font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color: #FFFFFF;
}
-->
</style>
</head>

<body>

<div align="center">
<form action="<%=MM_editAction%>" method="POST" enctype="multipart/form-data" name="nuevacartelera" id="nuevacartelera" onSubmit="checkFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',true,'','','','','','','');return document.MM_returnValue">
<table width="545" border="0" cellpadding="0" cellspacing="2">
<tr align="center">
<td height="50" colspan="7" valign="top" background="images/fondo_tit.jpg"><img src="images/trans.gif" width="540" height="15"><br>
<span class="style16">Agregar Cartelera</span></td>
</tr>
<tr align="center" valign="top">
<td colspan="7" bgcolor="#2D4C61"><table width="400" border="0" cellspacing="2" cellpadding="2">
<tr>
<td width="141" class="style8"><div align="left">Nombre en Español </div></td>
<td width="245"><div align="left">
<input name="NombreSpanish2" type="text" id="NombreSpanish22" size="32">
</div></td>
</tr>
<tr>
<td class="style8"><div align="left">Nombre en Inglés </div></td>
<td><div align="left">
<input name="NombreEnglish2" type="text" id="NombreEnglish22" size="32">
</div></td>
</tr>
<tr>
<td class="style8"><div align="left">Clasificacion</div></td>
<td><div align="left">
<input name="Clasificacion2" type="text" id="Clasificacion22" size="32">
</div></td>
</tr>
<tr>
<td class="style8"><div align="left">Pais</div></td>
<td><div align="left">
<input name="Pais2" type="text" id="Pais22" size="32">
</div></td>
</tr>
<tr>
<td class="style8"><div align="left">Año de Creación </div></td>
<td><div align="left">
<input name="FechaRelease2" type="text" id="FechaRelease22" size="32">
</div></td>
</tr>
<tr>
<td class="style8"><div align="left">Director</div></td>
<td><div align="left">
<input name="Director2" type="text" id="Director22" size="32">
</div></td>
</tr>
<tr>
<td class="style8"><div align="left">Reparto</div></td>
<td><div align="left">
<input name="Reparto2" type="text" id="Reparto22" size="32">
</div></td>
</tr>
<tr>
<td class="style8"><div align="left">Sitio Oficial </div></td>
<td><div align="left">
<input name="SitioOficial2" type="text" id="SitioOficial22" size="32">
</div></td>
</tr>
<tr>
<td class="style8"><div align="left">Salas de Exhibicion </div></td>
<td><div align="left">
<input name="SalasExhibicion2" type="text" id="SalasExhibicion22" size="32">
</div></td>
</tr>
<tr>
<td class="style8"><div align="left">Horarios</div></td>
<td><div align="left">
<input name="Horarios2" type="text" id="Horarios22" size="32">
</div></td>
</tr>
<tr>
<td class="style8"><div align="left">Imagen</div></td>
<td><div align="left">
<input name="ImagenArriba2" type="file" id="ImagenArriba22" onChange="checkOneFileUpload(this,'GIF,JPG,JPEG,BMP,PNG',true,'','','','','','','')">
</div></td>
</tr>
<tr>
<td class="style8"><div align="left">Ruta de la Imagen </div></td>
<td><div align="left">
<input name="Imagen2" type="text" id="Imagen22" value="../cartelera/" size="32">
</div></td>
</tr>
<tr>
<td valign="top" class="style8"><div align="left">Sinopsis</div></td>
<td><div align="left">
<textarea name="textarea" cols="32" id="textarea2"></textarea>
</div></td>
</tr>
<tr>
<td colspan="2"><div align="center">
<input type="submit" name="Submit2" value="Agregar Cartelera">
</div></td>
</tr>
</table></td>
</tr>
</table>

<input type="hidden" name="MM_insert" value="nuevacartelera">
</form>
<p> </p>
</div>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>

Replies

Replied 05 May 2005 20:49:31
05 May 2005 20:49:31 Chris Charlton replied:
Sorry, commercial extension help is required to be posted in the extensions' own forum. Thank you.

<b>Pure ASP Upload:</b>
Homepage - www.dmxzone.com/ShowDetail.asp?NewsId=1622
Forum - www.dmxzone.com/forum/default.asp?NewsId=1622

P.S.&gt; Welcome to the DMXzone community. <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle>

~ ~ ~ ~ ~ ~ ~
Chris Charlton <i>- DMXzone Manager</i>
<font size=1>[ Studio MX/MX2004 | PHP/ASP | SQL | XHTML/CSS | XML | Actionscript | Web Accessibility | MX Extensibility ]</font id=size1>
Replied 05 May 2005 20:51:26
05 May 2005 20:51:26 Arturo Civit replied:
thanks Chris

Reply to this topic