Support forums
in

How to set the destination folder in uploader products?

Last post 01-03-2011, 10:57 AM by Eric. 0 replies.
Sort Posts: Previous Next
  •  01-03-2011, 10:57 AM 65579

    How to set the destination folder in uploader products?

    Ajax Uploader: 
    <%@ Page Language="C#" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <script runat="server"> 
        void Uploader_FileUploaded(object sender, UploaderEventArgs args)
        {
            //Copys the uploaded file to a new location.
            args.CopyTo("c:\\temp\\"+args.FileName);
            //You can also open the uploaded file's data stream.
            //System.IO.Stream data = args.OpenStream();
        }
    </script>
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head id="Head1" runat="server">
        <title>Selecting multiple files for upload</title> 
    </head>
    <body>
        <form id="form1" runat="server">
                <CuteWebUI:Uploader runat="server" ID="Uploader1" InsertText="Upload Multiple Files (Max 10M)"
                    MultipleFilesUpload="true" OnFileUploaded="Uploader_FileUploaded">
                    <ValidateOption MaxSizeKB="10240" />
                </CuteWebUI:Uploader>                  
            </div>
        </form>
    </body>
    </html>
    PHP Uploader: 
    Solution 1:
    <?php require_once "phpuploader/include_phpuploader.php" ?>   
    <html>   
    <body>   
           <?php   
                $uploader=new PhpUploader();   
                $uploader->Name="myuploader";   
                $uploader->SaveDirectory="/myfolder";   
                $uploader->Render();   
            ?>                  
    </body>   
    </html>
    Solution 2:
    <?php require_once "phpuploader/include_phpuploader.php" ?>   
    <html>   
    <body>   
            <form id="form1" method="POST">   
                <?php   
                    $uploader=new PhpUploader();   
                    $uploader->Name="myuploader";    
                    $uploader->Render();   
                ?>   
            </form>   
    <?php   
    //Gets the GUID of the file based on uploader name   
    [email protected]$_POST["myuploader"];   
    if($fileguid)   
    {   
        //get the uploaded file based on GUID   
        $mvcfile=$uploader->GetUploadedFile($fileguid);   
        if($mvcfile)   
        {   
            //Gets the name of the file.   
            echo($mvcfile->FileName);   
            //Gets the temp file path.   
            echo($mvcfile->FilePath);   
            //Gets the size of the file.   
            echo($mvcfile->FileSize);    
               
            //Copys the uploaded file to a new location.   
            $mvcfile->CopyTo("/uploads");   
            //Moves the uploaded file to a new location.   
            $mvcfile->MoveTo("/uploads");   
            //Deletes this instance.   
            $mvcfile->Delete();   
        }   
    }   
    ?>  
    </body>   
    </html>
    ASP Uploader:
    Solution 1:
     <% @ Language="VBScript" %>  
    <!-- #include file="aspuploader/include_aspuploader.asp" -->  
    <html>   
    <body>   
            <form id="form1" method="POST">   
                <%
                    Dim uploader   
                    Set uploader=new AspUploader   
                    uploader.Name="myuploader"
                    uploader.SaveDirectory="/myfolder"
                    uploader.Render()  
                %>
            </form>   
    </body>   
    </html>
    Solution 2:
    <%@ Language="VBScript" %>   
    <!-- #include file="aspuploader/include_aspuploader.asp" -->  
    <html>   
    <head>   
    </head>   
    <body>   
            <form id="form1" method="POST">   
            <%   
                Dim uploader   
                Set uploader=new AspUploader   
                uploader.Name="myuploader"  
                uploader.Render()   
            %>   
            </form>   
                   
    <%   
      
    If Request.Form("myuploader")&""<>"" Then  
        Dim mvcfile   
        Set mvcfile=uploader.GetUploadedFile(Request.Form("myuploader"))    
        targetfilepath= "savefiles/myprefix_" & mvcfile.FileName   
        mvcfile.MoveTo( server.mappath(targetfilepath))       
        Response.Write("<div style='font-family:Fixedsys'>")   
        Response.Write("Uploaded File")   
        Response.Write("<br/><br/>FileName: ")   
        Response.Write(mvcfile.FileName)   
        Response.Write("<br/>FileSize: ")   
        Response.Write(mvcfile.FileSize)   
    '   Response.Write("<br/>FilePath: ")   
    '   Response.Write(mvcfile.FilePath)   
        Response.Write("</div>")   
    End If  
      
    %>   
                               
    </body>   
    </html> 
     
     
View as RSS news feed in XML
Powered by Community Server (Commercial Edition), by Telligent Systems