Type mismatch: '[string: ""]'

M

Mark Sargent

Hi All,

why am I getting this error..? Cheers.

Mark Sargent.


Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: ""]'
/Classifieds/ClassifiedImageResize.asp, line 27

<%
' Create instance of AspJpeg
Set Jpeg = Server.CreateObject("Persits.Jpeg")

' Compute path to source image
Path = Server.MapPath(FilePath)

' Open source image
Jpeg.Open Path

' Create an instance of AspUpload object
Set Upload = Server.CreateObject("Persits.Upload")

' Decrease image size by %
((***Line 27***)) Jpeg.Width = Jpeg.OriginalWidth * Upload.Form("scale") /
100
Jpeg.Height = Jpeg.OriginalHeight * Upload.Form("scale") / 100

' Apply sharpening if necessary
' Jpeg.Sharpen 1, 130

' create thumbnail and save it to disk
FilePath = Replace(FilePath, "/", "\")
FilePath = Replace(FilePath, "ImageUploads\", "")
Jpeg.Save Server.MapPath("ImageUploads\Thumbs") & "\Thumb" & FilePath


%>
 
R

Ray at

What is line 27 and what does a response.write of the variables in question
yield?

Ray at home
 
C

Chris Barber

Upload.Form("scale") is probably not a number and as such the implicit
coercion to a number is failing.

Try debugging and finding out what this value is returning.

Chris.

Hi All,

why am I getting this error..? Cheers.

Mark Sargent.


Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: ""]'
/Classifieds/ClassifiedImageResize.asp, line 27

<%
' Create instance of AspJpeg
Set Jpeg = Server.CreateObject("Persits.Jpeg")

' Compute path to source image
Path = Server.MapPath(FilePath)

' Open source image
Jpeg.Open Path

' Create an instance of AspUpload object
Set Upload = Server.CreateObject("Persits.Upload")

' Decrease image size by %
((***Line 27***)) Jpeg.Width = Jpeg.OriginalWidth * Upload.Form("scale") /
100
Jpeg.Height = Jpeg.OriginalHeight * Upload.Form("scale") / 100

' Apply sharpening if necessary
' Jpeg.Sharpen 1, 130

' create thumbnail and save it to disk
FilePath = Replace(FilePath, "/", "\")
FilePath = Replace(FilePath, "ImageUploads\", "")
Jpeg.Save Server.MapPath("ImageUploads\Thumbs") & "\Thumb" & FilePath


%>
 
R

Rob Meade

...
((***Line 27***)) Jpeg.Width = Jpeg.OriginalWidth * Upload.Form("scale") /
100
Jpeg.Height = Jpeg.OriginalHeight * Upload.Form("scale") / 100


Try :

27: Jpeg.Width = Jpeg.OriginalWidth * (CInt(Upload.Form("scale")) / 100)

and

28: Jpeg.Height = Jpeg.OriginalHeight * (CInt(Upload.Form("scale")) / 100)

(I assume the next line was 28 etc...)

Regards

Rob
 
M

Mark Sargent

Hi All,

thanx..here is what is being passed to the problem page. Cheers.

Mark Sargent.

<HTML>
<HEAD>
<TITLE>AspJpeg - Form.asp</TITLE>
</HEAD>
<BODY>
<%
Dim FilePath
if Request.QueryString("FilePath") <> "" then
FilePath = Request.QueryString("FilePath")
End If
Response.Write FilePath
%>
<!-- Image upload form. Notice the ENCTYPE attribute -->
<FORM ENCTYPE="multipart/form-data" METHOD="POST"
ACTION="ClassifiedImageResize.asp?FilePath=<%=FilePath%>">
<TABLE CELLPADDING="3" CELLSPACING="0" BORDER="0" BGCOLOR="#00FF00"
align="center">
<TR>
<TD>Thumbnail Size:</TD>
<TD>
<SELECT NAME="scale">
<OPTION VALUE="75">75%
<OPTION VALUE="50">50%
<OPTION VALUE="25">25%
<OPTION VALUE="10">10%
</SELECT>
</TD>
</TR>
<TR>
<TD>Description:</TD>
<TD>
<TEXTAREA NAME="Description"></TEXTAREA>
</TD>
</TR>
<TR>
<TD COLSPAN="2">
<INPUT TYPE="SUBMIT" VALUE="Upload">
</TD>
</TR>
</TABLE>
</FORM>

</BODY>
</HTML>
 
M

Mark Sargent

Here is the error I get after adding what you suggested, Rob...Cheers..

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'CInt'
/Classifieds/ClassifiedImageResize.asp, line 27
 
C

Chris Barber

LINE 27:
Jpeg.Width = Jpeg.OriginalWidth * Upload.Form("scale") / 100

Mark, you *can't* fix this using syntax until you determine that the
following are both numeric:

Jpeg.OriginalWidth
Upload.Form("scale")

My money's on the second one not being numeric.

Do you know how to debug or do you need some pointers on what to do?

Chris.


Here is the error I get after adding what you suggested, Rob...Cheers..

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: 'CInt'
/Classifieds/ClassifiedImageResize.asp, line 27
 
R

Ray at

My money's on Chris.

<%
Response.write Jpeg.OriginalWidth & "<br>"
Response.Write Upload.Form("scale")
Response.End
%>

Ray at work
 
M

Mark Sargent

Hi All,

I see..Okay, after debugging, it appears that either nothing is passing to
the page or, I'm not calling Upload.Form("scale")
correctly as it doesn't write. I posted before the code from the page
passing the variables; have I got it wrong..? Cheers..

Mark Sargent.
 
M

Mark Sargent

Hi All,

K, I'm an "Idiot"..all together now, "Yes, you're an Idiot"..I was using the
below code on the page where a user could select the resize options. Thing
is, this code is for use when passing form values at the same time as
uploading a file. Thing is, the file upload was done on the previous
page..DOH..No need to call Upload.Form("scale") only need to call
Request.Form("scale")....if you understood all that, you're a
genuis...cheers all.

Mark Sargent.

ENCTYPE="multipart/form-data"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top