Problem AspSmartUpload

Discussion in 'General Web Coding' started by otvarak, Mar 24, 2005.

  1. otvarak

    otvarak Guppy

    Hello there,

    I am having problems with rewritting the following code into the Javascript.
    The vb code Works fine, but unfortunatelly I need to have it witten in JS.


    ==============================================
    Sample3.htm
    ==============================================
    <HTML>
    <BODY BGCOLOR="white">

    <H1>aspSmartUpload : Sample 3</H1>
    <HR>

    <FORM METHOD="POST" ACTION="script/Sample3.asp" ENCTYPE="multipart/form-data">
    <INPUT TYPE="FILE" NAME="FILE1" SIZE="50"><BR>
    <INPUT TYPE="FILE" NAME="FILE2" SIZE="50"><BR>
    <INPUT TYPE="FILE" NAME="FILE3" SIZE="50"><BR>
    <INPUT TYPE="FILE" NAME="FILE4" SIZE="50"><BR>
    <INPUT TYPE="SUBMIT" VALUE="Upload">
    </FORM>

    </BODY>
    </HTML>

    ==============================================
    Sample3.asp
    ==============================================
    <HTML>
    <BODY BGCOLOR="white">

    <H1>aspSmartUpload : Sample 3</H1>
    <HR>

    <%
    On Error Resume Next

    ' Variables
    ' *********
    Dim mySmartUpload
    Dim intCount

    ' Object creation
    ' ***************
    Set mySmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

    ' Only allow txt or htm files
    ' ***************************
    mySmartUpload.AllowedFilesList = "htm,txt"

    ' DeniedFilesList can also be used :
    ' Allow all files except exe, bat and asp
    ' ***************************************
    ' mySmartUpload.DeniedFilesList = "exe,bat,asp"

    ' Deny physical path
    ' *******************
    mySmartUpload.DenyPhysicalPath = True

    ' Only allow files smaller than 50000 bytes
    ' *****************************************
    mySmartUpload.MaxFileSize = 50000

    ' Deny upload if the total fila size is greater than 200000 bytes
    ' **********************************************
    mySmartUpload.TotalMaxFileSize = 200000

    ' Upload
    ' ******
    mySmartUpload.Upload

    ' Save the files with their original names in a virtual path of the web server
    ' **********************************************
    intCount = mySmartUpload.Save("/aspSmartUpload/Upload")
    ' sample with a physical path
    ' intCount = mySmartUpload.Save("c:\temp\")

    ' Trap errors
    ' ***********
    If Err Then
    Response.Write("<b>Wrong selection : </b>" & Err.description)
    Else
    ' Display the number of files uploaded
    ' ************************************
    Response.Write(intCount & " file(s) uploaded.")
    End If
    %>
    </BODY>
    </HTML>

    ==============================================


    Help will be very appriciated.
    We are having component aspsmartupload from www.aspsmart.com and all the samples work
    correctly but we need to have it rewritten into javascript.

    Thanks
  2. Stephen

    Stephen US Operations Staff Member

    Javascript is client side, and aspsmartupload is tool that works with a dll on windows servers, I don't think you can make that 100% javascript.
  3. otvarak

    otvarak Guppy

    Hi,

    I am not using only javascript, I intend to use asp with javascript. all those samples are using asp with vbscript and want to rewrite it using asp with javascript. I hope it is possible since I havent find any similar example on net.
  4. Stephen

    Stephen US Operations Staff Member

    ok, I understand now, I don't know how to do that, but prehaps another person does.
  5. doctorallia

    doctorallia Perch


    Give this a try!

    <%@ Language=JScript %>
    <%
    window.onerror=null;

    // Variables
    // *********
    var mySmartUpload;
    var intCount;

    // Object creation
    // ***************
    // I think you can use Server.CreateObject too but im not positive
    mySmartUpload = new ActiveXObject("aspSmartUpload.SmartUpload");

    // Only allow txt || htm files
    // ***************************
    mySmartUpload.AllowedFilesList = "htm,txt";

    // DeniedFilesList can also be used :
    // Allow all files except exe, bat && asp
    // ***************************************
    // mySmartUpload.DeniedFilesList = "exe,bat,asp";

    // Deny physical path
    // *******************
    mySmartUpload.DenyPhysicalPath = True;

    // Only allow files smaller than 50000 bytes
    // *****************************************
    mySmartUpload.MaxFileSize = 50000;

    // Deny upload if(the total fila size is greater than 200000 bytes
    // **********************************************
    mySmartUpload.TotalMaxFileSize = 200000;

    // Upload
    // ******
    mySmartUpload.Upload;

    // Save the files with their original names in a virtual path of the web server
    // **********************************************
    intCount = mySmartUpload.Save("/aspSmartUpload/Upload");
    // sample with a physical path
    // intCount = mySmartUpload.Save("c:\temp\")

    // Trap errors
    // ***********
    if(Err){
    Response.Write("<b>Wrong selection : </b>" + Err.description);
    }else{
    // Display the number of files uploaded
    // ************************************
    Response.Write(intCount + " file(s) uploaded.");
    }
    %>
  6. otvarak

    otvarak Guppy

    Hi Doctorallia,
    Your example don't work me .
    error masage in line :
    mySmartUpload.Upload;
  7. doctorallia

    doctorallia Perch

    what is the error?

    I am not too good with debugging jscript.. since i hardly ever use it.. but i can try.
  8. otvarak

    otvarak Guppy

    error is this line .

    write in form : oSmartUpload.Upload ();

    error :
    Request object error 'ASP 0206 : 80004005'
    Cannot call BinaryRead


    write in form : oSmartUpload.Upload ;
    error :
    HTTP Internal error Internet Explorer

    ----------------------------------------------------------

    This is shortly examples , also are there identical problem.

    Error Line: oSmartUpload.Upload () ;


    Error masage :
    Request object error 'ASP 0206 : 80004005'
    Cannot call BinaryRead


    ----------------------------Samples ASP whith VBscript---
    <HTML>
    <BODY>
    <%
    Dim oSmartUpload
    Dim file
    Dim intCount
    intCount=0

    Set oSmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload")

    oSmartUpload.Upload

    For each file In oSmartUpload.Files
    If not file.IsMissing Then
    file.SaveAs("c:\Temp\" & file.FileName)
    Response.Write("Name = " & file.Name & "<BR>")
    Response.Write("Size = " & file.Size & "<BR>")
    intCount = intCount + 1
    End If
    Next
    Response.Write(intCount & " pocet suborov odoslanych na server.<BR>")
    %>
    </BODY>
    </HTML>


    -----------------------Samples Asp whith JavaScript---
    <HTML>
    <BODY>
    <%
    var oSmartUpload, file, intCount, i ;
    var intCount=0 ;

    oSmartUpload = Server.CreateObject("aspSmartUpload.SmartUpload");

    //oSmartUpload.Upload ;
    oSmartUpload.Upload () ;

    for(i=1; i<= oSmartUpload.Upload.Files; i++);
    {
    file.SaveAs("c:\Temp\"+file.Name);
    Response.Write("Name = " + file.Name + "<BR>");
    Response.Write("Size = " + file.Size + "<BR>");
    intCount=intCount + 1 ;
    }
    Response.Write(intCount+" pocet suborov odoslanych na server.<BR>");

    %>
    </BODY>
    </HTML>
    -----------------------------------------------------------
  9. ravivyas

    ravivyas Guppy

    I have the some probs

    Please help me how to use AspSmartUpload in ASP with Javascript
  10. yogie

    yogie Guppy

    hello,

    is theres another upload script instead of aspsmartupload, because i only know aspsmartupload

    please advise

    thanks
  11. Stephen

    Stephen US Operations Staff Member


    There is ASPUpload, you can also do uploads in pure asp without need fo a com object, and finally we have DundasUpload installed.

    the ASPSmartUpload has been unsupported by the developer for a long time now, and some windows patches a year or so back seemed to break many functions on aspsmartupload.
  12. TechLead

    TechLead Guppy

    Hi,
    Following error occurred when i creating SmartUpload object.
    Error :Server object: 006~ASP 0177~Server.CreateObject Failed~800401f3


    this error occred only in windows server 2008.
    in windows server 2003 it's working fine

    here is my used code
    Dim strFileName
    mimeType = "application/msword"
    strPath = "C:\\Warna\\ClasscASp\\Document"
    docNumber = "000001"
    extension = "doc"
    Set MyUpload = Server.CreateObject("AspSmartUpLoad.SmartUpLoad")
    MyUpload.ContentDisposition = "inline"
    MyUpload.DownloadFile strPath & docNumber & "." & extension, mimeType, strFileName

    Response.Flush()

    Can anyone have idea wt should I do with windows server 2008?
  13. Stephen

    Stephen US Operations Staff Member

    change upload objects, aspsmart company stopped supporting aspsmartupload about 2.5 years ago :(

    I'd recommend aspupload

    it even breaks on windows 2003 servers with some patches, and sometimes works, very bad one to use.
  14. TechLead

    TechLead Guppy

    Thanks Stephen.Do you know any open source product smiler to aspsmartupload???
  15. Stephen

    Stephen US Operations Staff Member

    i don't know any open source, there is that is free however.

Share This Page

JodoHost - 26,000 hosting end-users in 100 countries
Plesk Web Hosting
VPS Hosting
H-Sphere Web Hosting
Other Services