Avatar of Gerano
GeranoFlag for South Africa asked on

Object not supported error on SmartUpload filename retrieval

I'm using ASP AmartUpload to upload files to a folder which works fine. I'm aso successful in retrieving other form data using uploadObj.form.

However, when using uploadObj.files to retrieve the filenames to I can write them to the database I get an error that states: Object doesn't support this property or method. All the material I've read states that it's .files but it clearly doesn't work.
Variables have been checked, all are valid and declared.

Here is the code:
Note that I'm not doing the response.redirect yet as I first want to get the filenames written to the page to verify they are there.

<% @Language = VBScript %>
<% Option Explicit %>


<% Dim intID, vchThumbnail, vchImage, uploadObj

        'Create an instance of our SmartUpload object.
        Set uploadObj = Server.CreateObject("aspSmartUpload.SmartUpload")

            'Set allowed files
            uploadObj.AllowedFilesList = "jpg, gif"

        'Process the upload
        uploadObj.Upload

        'Save the file
        uploadObj.Save Server.MapPath("../Media/ProductImages/")
             

intID = uploadObj.Form("intID")
vchThumbnail  = uploadObj.files("vchThumbnail")
vchImage  = uploadObj.files("vchImage")
 %>
<%'Response.Redirect "EditProduct.asp?intID="&intID&"&vchThumbnail='"&vchThumbnail&"'&vchImage='"&vchImage&"'"    
    %>
      
      <% =  intID%><br>
      <% = vchThumbnail %><br>
      <% = vchImage %><br>
VB ScriptASP

Avatar of undefined
Last Comment
Gerano

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
JesterToo

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
Gerano

I get the same error: Object doesn't support this property or method: 'UploadedFiles'
JesterToo

Have you tried FreeAspUpload to see if it works better?
ASKER
Gerano

I have not - my preference is to get the existing to work (fix code on two lines) rather than deploy a new solution. All down to time contstraints.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
JesterToo

Understand :)

The problem may be with the argument "vchThumbnail"... does it agree with the following constraint:

"To reference an individual file object from the collection you may use a 1-based integer index, or a string corresponding to the NAME attribute of an <INPUT TYPE="FILE">  item of your upload form."

It appears that your code (as much as was presented, anyway) complies with all the other requirements of using the Files collection.
ASKER
Gerano

Good thinking.
The code is below. It looks fine to me, perhpas you can spot something.

<form method="POST" enctype="multipart/form-data" action="UploadImages.asp">
            <input type="Hidden" name="intID" value="<% =intID %>">
            <h1>Upload Images</h1>
            You are uploading images for: <strong><% =ContentRS("vchTitle") %></strong>
            <br /><br />
            Click the browse button for the images, select the files to upload from your folders and click the Upload button
            <br />
            Thumbnail: <input type="File" name="vchThumbnail" class="FormBox"><br />
            Large Image: <input type="File" name="vchImage" class="FormBox"><br />
            <input type="Submit" value="Upload" class="FormButton">
            </form>