Live Support, Chat, Upload Control and Rich Text Editor
Welcome to Support forums Sign in | Join | Help |Client Center
in Search

how can i delete the selected image?

Last post 02-07-2012, 11:45 AM by ger. 4 replies.
Sort Posts: Previous Next
  •  02-05-2012, 3:58 PM 72924

    how can i delete the selected image?

    <?php require_once "phpuploader/include_phpuploader.php" ?>
    <?php session_start(); ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>
            Form - Start uploading manually
        </title>
        <link href="demo.css" rel="stylesheet" type="text/css" />
                
        <script type="text/javascript">
        function doStart()
        {
            var uploadobj = document.getElementById('myuploader');
            if (uploadobj.getqueuecount() > 0)
            {
                uploadobj.startupload();
            }
            else
            {
                alert("Please browse files for upload");
            }
        }
        </script>
        
    </head>
    <body>
        <div class="demo">     
                <h2>Start uploading manually</h2>
                <p>This sample demonstrates how to start uploading manually after file selection vs automatically.</p>
                <P>Allowed file types: <span style="color:red">jpg, gif, txt, png, zip</span></p>

                <!-- do not need enctype="multipart/form-data" -->
                <form id="form1" method="POST">
                    <?php                
                        $uploader=new PhpUploader();
                        $uploader->MaxSizeKB=10240;
                        $uploader->Name="myuploader";
                        $uploader->InsertText="Select multiple files (Max 10M)";
                        $uploader->AllowedFileExtensions="*.jpg,*.png,*.gif,*.txt,*.zip,*.rar";    
                        $uploader->MultipleFilesUpload=true;
                        $uploader->ManualStartUpload=true;
                        $uploader->Render();
                    ?>
                    <br /><br /><br />
                    <button id="submitbutton" onclick="doStart();return false;">Start Uploading Files</button>

                </form>
                
                <br/><br/><br/>
    <?php
    $fileguidlist=@$_POST["myuploader"];

    if($fileguidlist)
    {
        $guidlist=explode("/",$fileguidlist);
        
        echo("<div style='font-family:Fixedsys;'>");
        echo("Uploaded ");
        echo(count($guidlist));
        echo(" files:");
        echo("</div>");
        echo("<hr/>");
        
        foreach($guidlist as $fileguid)
        {
            
            $mvcfile=$uploader->GetUploadedFile($fileguid);
            
            if($mvcfile)
            {
                echo("<div style='font-family:Fixedsys;border-bottom:dashed 1px gray;padding:6px;'>");
                echo("FileName: ");
                echo($mvcfile->FileName);
                echo("<br/>FileSize: ");
                echo($mvcfile->FileSize." b");
                echo("<br/>FilePath: ");
                echo($mvcfile->FilePath);
                echo("</div>");
                
                $path = "C:\wamp\www\multiupload\savefiles" . $mvcfile->FileName;
                
                //Moves the uploaded file to a new location.
                //$mvcfile->MoveTo("/uploads");
                //Copys the uploaded file to a new location.
                //$mvcfile->CopyTo("/uploads");
                //Deletes this instance.
                //$mvcfile->Delete();
            }
        }
    }
    ?>
                    
        </div>
    </body>
    </html>
     
      i tried to change the path of the $mvcfile->Delete($path); but it doesn't work, can anyone guide me the ways of delete the selected images?
  •  02-05-2012, 11:58 PM 72926 in reply to 72924

    Re: how can i delete the selected image?

    Hi Ger,
     
    Method $mvcfile->Delete(); use to delete the temp file. If you use the line below to save the upload file. Then you need to write you own code to delete this file. Because it already save into your custom store folder. The php uloader has not the delete method in-build to delete it.
     
    $path = "C:\wamp\www\multiupload\savefiles" . $mvcfile->FileName;  
     
    Regards,
     
    Ken 
  •  02-06-2012, 2:43 AM 72932 in reply to 72926

    Re: how can i delete the selected image?

    Hi Kenneth,
     
    Thanks for the reply, so do you have any example of delete the file, because this is  my first project in college of using php so everything seems so new to me @@.
  •  02-07-2012, 6:35 AM 72940 in reply to 72932

    Re: how can i delete the selected image?

    Hi ger,
     
    Please refer to http://php.net/manual/en/function.unlink.php , it should help.
     
    Regards,
     
    Ken 
  •  02-07-2012, 11:45 AM 72949 in reply to 72940

    Re: how can i delete the selected image?

    Hi Kenneth,
     
    Thanks for the help, i will look into it ;)
View as RSS news feed in XML
Powered by ASP.Net
Copyright 2003 - 2017 CuteSoft Components Inc.. All rights reserved.