Help getting script to use GetUploadedFile when using 2 ASP files...

Last post 09-28-2016, 8:51 AM by MarkRadaba. 3 replies.
Sort Posts: Previous Next
  •  09-23-2016, 11:45 AM 84771

    Help getting script to use GetUploadedFile when using 2 ASP files...

    Is there a way to break this down in to 2 files, so I can use the second file will move the file and process some database entries?  I'm getting an error on the GetUploadedFile line.  It works as one file, but when I split it up in to 2 files, it fails.

     

             <h2>Single File Upload</h2> 
            <p>A basic sample demonstrating the use of the Upload control.</p> 

            <form id="form1" method="POST">
      <%
                Dim uploader
                Set uploader=new AspUploader
                uploader.MaxSizeKB=10240 
                uploader.Name="myuploader" 
                uploader.InsertText="Upload File (Max 10M)"
                uploader.MultipleFilesUpload=true

                response.write (uploader.GetString())  
      %>
     
            </form>

            <br/><br/> 

    <%
    targetfile = "myphoto1.jpg"

    If Request.Form("myuploader")&""<>"" Then 
      Dim mvcfile 
         Set mvcfile=uploader.GetUploadedFile(Request.Form("myuploader")) 
        mvcfile.MoveTo(targetfile)
    End If
     
    %>

  •  09-27-2016, 4:05 PM 84778 in reply to 84771

    Re: Help getting script to use GetUploadedFile when using 2 ASP files...

    Any help from anyone?  I'm getting an "Object expected" error when this is split between two pages.
  •  09-28-2016, 8:16 AM 84782 in reply to 84771

    Re: Help getting script to use GetUploadedFile when using 2 ASP files...

    Hi,

     

    Please try the way below, it support split multiple files.

     

    1. <%@ Language="VBScript" %>  
    2. <!-- #include file="aspuploader/include_aspuploader.asp" -->  
    3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">  
    4. <html xmlns="http://www.w3.org/1999/xhtml">  
    5. <head>  
    6.     <title>  
    7.         example  
    8.     </title>  
    9. </head>  
    10. <body>  
    11.     <div>                          
    12.             <form id="form1" method="POST">  
    13.             <%  
    14.             Dim uploader  
    15.             Set uploader=new AspUploader  
    16.             uploader.MaxSizeKB=10240  
    17.             uploader.Name="myuploader"  
    18.             uploader.InsertText="Upload File (Max 10M)"  
    19.             uploader.MultipleFilesUpload=true  
    20.             %>  
    21.             <%=uploader.GetString() %>  
    22.             </form>  
    23.               
    24.             <br/><br/>  
    25. <%  
    26. If Request.Form("myuploader")&""<>"" Then  
    27.   
    28.     Dim list,i  
    29.       
    30.     'Gets the GUID List of the files based on uploader name   
    31.     list=Split(Request.Form("myuploader"),"/")  
    32.   
    33.     For i=0 to Ubound(list)  
    34.         Dim mvcfile  
    35.         'get the uploaded file based on GUID  
    36.         Set mvcfile=uploader.GetUploadedFile(list(i))  
    37.         mvcfile.CopyTo(Server.MapPath(".")&"/savefiles/"&mvcfile.FileName)  
    38.     Next  
    39. End If  
    40.   
    41. %>  
    42.               
    43.     </div>  
    44. </body>  
    45. </html>  
     

    regards,

     

    Ken 

  •  09-28-2016, 8:51 AM 84784 in reply to 84782

    Re: Help getting script to use GetUploadedFile when using 2 ASP files...

    Ken,

     

    I'm only trying to upload one file.

     

    What I'm trying to do is have a form with an upload button,, so when you clicked on it, it uploaded the file and the info from the form on to another file, which then grabbed the uploaded file info from the previous page and rename it, along with other tasks such as database entry, etc.  When I tested it, it looks like it was working, but then tripped an error on the second file at the line:

     

    Set mvcfile=uploader.GetUploadedFile(Request.Form("myuploader"))

     

    The error received is:

     

    Object required: ''  

     

     

View as RSS news feed in XML