Type mismatch: '[string: ""]'

Discussion in 'ASP General' started by Mark Sargent, Nov 2, 2003.

  1. Mark Sargent

    Mark Sargent Guest

    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


    %>
     
    Mark Sargent, Nov 2, 2003
    #1
    1. Advertising

  2. Mark Sargent

    Ray at Guest

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

    Ray at home

    "Mark Sargent" <> wrote in message
    news:...
    > 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
    >
    >
    > %>
    >
    >
     
    Ray at, Nov 2, 2003
    #2
    1. Advertising

  3. Mark Sargent

    Chris Barber Guest

    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.

    "Mark Sargent" <> wrote in message
    news:...
    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


    %>
     
    Chris Barber, Nov 2, 2003
    #3
  4. Mark Sargent

    Rob Meade Guest

    "Mark Sargent" wrote...

    > ((***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
     
    Rob Meade, Nov 2, 2003
    #4
  5. Mark Sargent

    Mark Sargent Guest

    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>
     
    Mark Sargent, Nov 3, 2003
    #5
  6. Mark Sargent

    Mark Sargent Guest

    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
     
    Mark Sargent, Nov 4, 2003
    #6
  7. Mark Sargent

    Ray at Guest

    And what's on line 27 again?

    Ray at home

    "Mark Sargent" <> wrote in message
    news:...
    > 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
    >
    >
     
    Ray at, Nov 4, 2003
    #7
  8. Mark Sargent

    Chris Barber Guest

    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.


    "Mark Sargent" <> wrote in message
    news:...
    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
     
    Chris Barber, Nov 4, 2003
    #8
  9. Mark Sargent

    Ray at Guest

    My money's on Chris.

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

    Ray at work

    "Chris Barber" <> wrote in message
    news:...
    > 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.
    >
    >
    > "Mark Sargent" <> wrote in message
    > news:...
    > 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
    >
    >
    >
     
    Ray at, Nov 4, 2003
    #9
  10. Mark Sargent

    Mark Sargent Guest

    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.
     
    Mark Sargent, Nov 4, 2003
    #10
  11. Mark Sargent

    Mark Sargent Guest

    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"
     
    Mark Sargent, Nov 5, 2003
    #11
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. data type mismatch error

    , Aug 10, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    635
    Karl Seguin
    Aug 10, 2005
  2. Harry Pehkonen

    win32com, string array --> Type mismatch?

    Harry Pehkonen, Aug 8, 2003, in forum: Python
    Replies:
    2
    Views:
    1,873
    Harry Pehkonen
    Aug 11, 2003
  3. Type mismatch: '[string: ""]'

    , Dec 14, 2005, in forum: ASP General
    Replies:
    2
    Views:
    147
    Kyle Peterson
    Dec 14, 2005
  4. Snow
    Replies:
    3
    Views:
    220
    Firas S Assaad
    Oct 27, 2006
  5. programmingzeal
    Replies:
    0
    Views:
    1,124
    programmingzeal
    May 6, 2012
Loading...

Share This Page