Get name of the file but no upload the file

Last post 10-24-2012, 9:19 AM by jaubrun. 3 replies.
Sort Posts: Previous Next
  •  10-24-2012, 4:53 AM 75044

    Get name of the file but no upload the file

    Hi everybody, 
    For my project i just want to us phpuploader for get the name of all the files who selected by the client.
    I don't want to upload the files.
    Have you got a solution for me?

     

    Thanks a lot and good work for php uploader :) 

  •  10-24-2012, 7:41 AM 75046 in reply to 75044

    Re: Get name of the file but no upload the file

    Hi jaubrun,

     

    You can achieve it in API "CuteWebUI_AjaxUploader_OnSelect". like the example below, it will alert the upload file name, then cancel the upload.

     

    1. <?php require_once "phpuploader/include_phpuploader.php" ?>  
    2. <?php session_start(); ?>  
    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.   
    12.           
    13.                 <?php                  
    14.                     $uploader=new PhpUploader();  
    15.                     $uploader->Name="myuploader";  
    16.                     $uploader->InsertText="Select multiple files (Max 10M)";  
    17.                     $uploader->MultipleFilesUpload=true;  
    18.                     $uploader->Render();  
    19.             ?>  
    20.   
    21. </body>  
    22.   
    23.  <script type='text/javascript'>  
    24.      function CuteWebUI_AjaxUploader_OnSelect(files)  
    25.      {  
    26.         for(var i=0;i<files.length;i++)  
    27.         {  
    28.             //get file name  
    29.             alert(files[i].FileName);  
    30.             //cancel the upload  
    31.             files[i].Cancel();  
    32.         }  
    33.      }  
    34.  </script>  
    35. </html>  
     

    Regards,

     

    Ken 

  •  10-24-2012, 8:51 AM 75047 in reply to 75046

    Re: Get name of the file but no upload the file

    IT WOOOOORK !!!
    Thanks a lot, but ( i'm sorry i'm a difficult guy ) how can i get the name of the files in PHP?
    Because i want to insert them in my database.

    I work for find a solution

     

    10000 Thanks 

  •  10-24-2012, 9:19 AM 75048 in reply to 75047

    Re: Get name of the file but no upload the file

    i have find a solution but not with phpuploader

    If someone want :

     

     

     

     <html>
    <head>
    <script type="application/javascript" src="jQuery_1-7.js"></script>
    <script type="application/javascript">$(document).ready( function() {
          $('button.adder').click( function() {
                number = ($(this).parent().children().size() - 1) / 2;
                $(this).parent().append($(this).attr('data-prototype').replace('__number__', number));
          });
    });</script>
    </head>
    <body>


    <?php










    $passage = isset($_POST['passage']) ? $_POST['passage']: 0;
    if ($passage == 0)
    {
           echo "
                Maintenez <kbd>Ctrl</kbd> en sélectionnant les images pour en prendre plusieurs à la fois<!--<![endif]-->
            <form name ='formulaire' method ='POST'>
                   <input type='file' name='files[]' multiple='multiple' /><br />
                    <input type = 'hidden' name = 'passage' value = '1' />
                    <button type = 'submit'>OK </button>
            </form>";
    }
    else
    {      
                echo"<table border='0'>";
                      foreach($_POST['files'] as $NameFiles)
                      {
                            echo "
                                        <TR>
                                              <TD  style='background-image: url(resources/mod.gif);' width='300'>".$NameFiles."</TD>
                                              <TD style='background-image: url(resources/mod.gif);' width='1'><img src='resources/uploadok.png' /></TD>
                                        </TR>
                                  ";
                      }
                echo"</table>";
    }


    ?>
    </html>

View as RSS news feed in XML