SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SAFileUp in Javascript .save object error

    I am attempting to convert a SAFileUp asp upload script into javascript. (This isn't my idea, it's the way my work wants it) It runs smoothly in asp but when I convert it, I get almost all the way through the code till I hit.

    Code JavaScript:
        oFileUp.Form("myFile").Save

    Which gives me the following error:
    Microsoft JScript runtime error '800a01b6'

    Object doesn't support this property or method
    Any help would be great. Full code below:

    Code JavaScript:
    <%@LANGUAGE="JAVASCRIPT" CODEPAGE="1252"%>
    <%
    var FCONT;
    var myFile;
    var oFileUp = Server.CreateObject("SoftArtisans.FileUp");
    //oFileUp = new ActiveXObject("SoftArtisans.FileUp");
    oFileUp.Path = Server.MapPath("/CellularInv/docs");
     if(typeof(oFileUp.Form("myFile"))== "object")
     {
      if(! oFileUp.Form("myFile").IsEmpty){
       FCONT = oFileUp.Form("myFile").ContentType;
       switch(FCONT.toLowerCase())
       {
             case "application/pdf":
              Response.Write ("<P>" + oFileUp.ShortFileName + " filetype application/pdf has been approved.");
              break;
             case "text/plain": 
              Response.Write ("<P>" + oFileUp.ShortFileName + " filetype text/plain has been approved.");
              break;
             case "application/rtf" :
              Response.Write ("<P>" + oFileUp.ShortFileName + " filetype application/rtf has been approved.");
              break;
             case "application/msexcel" :
              Respone.Write ("<P>" + oFileUp.ShortFileName + " filetype application/msexcel has been approved.");
              break;
             case "application/msword" :
              Response.Write ("<P>" + oFileUp.ShortFileName + " filetype application/msword has been approved.");
              break;
             default:
             {
              oFileUp.Delete;
              Response.Write  ("<P>You can only upload .doc, .txt, .pdf, .rtf && .xls files.");
              Response.End ;
              break;
             } 
        }
        oFileUp.Form("myFile").Save
        if(Err.Number != 0){
         Response.Write ("<B>An error occurred while saving the file</B><BR>" +  Err.Description + " (" + Err.Source + ")");
         Response.End;
       Response.Write ("<H3>FileUp Saved the File Successfully</H3>");
       Response.Write ("<DL>");
       Response.Write ("<DT><B>Path on server</B></DT><DD>" + oFileUp.Form("myFile").ServerName + "</DD>");
       Response.Write ("<DT><B>Path on client</B></DT><DD>" + oFileUp.Form("myFile").UserFilename + "</DD>");
       Response.Write ("<DT><B>Short filename</B></DT><DD>" + oFileUp.Form("myFile").ShortFilename + "</DD>");
       Response.Write ("<DT><B>Byte size</B></DT><DD>" + oFileUp.Form("myFile").TotalBytes + "</DD>");
       Response.Write ("<DT><B>Content type</B></DT><DD>" + oFileUp.Form("myFile").ContentType + "</DD>");
       Response.Write ("</DL>");
      }
    }}	
    %>

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is an ASP question, better posted in ASP forum.

    Did you try
    oFileUp.Form("myFile").Save();
    ?

    Methods called using jscript I think need to have parentheses after them.

  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2005
    Posts
    94
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No I didn't. That was it. I knew it was going to be something simple that I was just overlooking.

    Thanks for the help.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •