Control customization

Last post 02-21-2010, 6:51 PM by Adam. 12 replies.
Sort Posts: Previous Next
  •  02-10-2010, 4:25 AM 58628

    Control customization

    Hello to all.
     
    I just downloaded PHPFileUploader and would like to know if there is an option to dynamically delete a file after it's uploaded but before the whole form is submitted. In other words I'd like to show a X image next to each uploaded file, so that when clicked it will remove the respective file.
     
    Also, I'm reading in the include_phpuploader.php the following (and other similar ones):
     
        /// It allows the developers specify a server control to use as the insert button of ajax uploader.
        public $InsertButtonID;
     
    So what am I supposed to put in there in order to customize the Browser to let's say a simple image?
     
    Oh, and one final question, I will be using this script to upload files of the following file types: .dox .xls .txt .pdf
    So, ideally, I'd like to change the default paperclip icon on the left of each uploaded file so that it shows an icon according to the uploaded file. For example an PDF icon for .pdf, an XLS ion for .xls etc... Is that possible?
     
    Thanks in advance for your replies.
  •  02-10-2010, 3:06 PM 58647 in reply to 58628

    Re: Control customization

    PrinceOfAbyss,

    For the first question, please check the following example. It should meet your requirement.
     
    For the second question, please try the following code:
     
    1. <img id="uploadbutton" src="http://phpfileuploader.com/images/upload.png" />   
    2. <?php   
    3.   
    4.     $uploader=new PhpUploader();   
    5.     $uploader->Name="myuploader";   
    6.     //specify a button instead the uploader create it own button   
    7.     $uploader->InsertButtonID="uploadbutton";   
    8.     //Where'd the files go?   
    9.     //$uploader->SaveDirectory="/myfolder";   
    10.     $uploader->Render();   
    11. ?>  

    For the final question, it's possible. You need to modify the attachment example to meet your own requirements.

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  02-10-2010, 5:23 PM 58650 in reply to 58647

    Re: Control customization

    Thank you so very much for your reply.
     
    Actually, I've figured out most of my needs till now, I even found a way to achieve the hardest thing I needed (an appropriate icon next to the file uploaded).
     
    It's a single replacement in uploader.js, however as it involved some RE to figure it out, I'm not quite sure if I'm allowed to post it in here to help others, or keep it for myself...
     
    Anyway, the final result of my "hack" looks like this:
     
     
  •  02-10-2010, 11:48 PM 58655 in reply to 58650

    Re: Control customization

    Hi,
     
    Uploader provide client side event to let developers replace the queue table.
     
    So you need not modify the uploader.js
     
    Here is the document for ASP.NET version.
     
     
    The client API is same for PHP,
     
    so you can do this way :
     
    <script>
    function CuteWebUI_AjaxUploader_OnQueueUI(list)
    {
        var uploader=this;
        //draw your own table using the list data.
        return false;
    }
    </script>
     
    Regards,
    Terry
  •  02-11-2010, 12:50 PM 58665 in reply to 58655

    Re: Control customization

    WOW
     
    This is more difficult than I thought. I have followed the ajax-attachments.php example, however the custom table of uploaded files is not displayed. I figured that the problem was that I had declared the upload folder in the initialization of the script using $uploader->SaveDirectory = "myfolder";
     
    Then, I commented this statement, and the table appeared, but then the files where not moved of course to that folder, so I had to do it manually in the ajax-attachments-handler.php, where it says
            //process the file here , move to some where
            //rename(...)    

    So under those comments I typed
    $mvcfile->moveTo("myfolder")
    and it worked.  However, then I had the problem when I wanted to remove the file, where it is removed from the table, but not physically from the server...
     
    I'm so confused :( Isn't there a complete example on how to set this up, as it's getting really frustrating...
  •  02-11-2010, 10:23 PM 58679 in reply to 58665

    Re: Control customization

    Hi,
     
    Once you use SaveDirectory or MoveTo to move the file , the GetUploadedFile will return null
     
    and you need maintain the list by yourself.
     
    You can maintain it by add the file information to session of database.
     
    Regards,
    Terry
  •  02-12-2010, 3:22 AM 58680 in reply to 58679

    Re: Control customization

    Hi.
     
    Thanks for your reply.
     
    Another question, is it possible to customize the button of the manual start upload? Choose an image to perform that for example... Or does it have to be a classic button?
  •  02-16-2010, 9:18 AM 58719 in reply to 58680

    Re: Control customization

    Dear PrinceofAbyss,
     
    These two examples source code can be found in download package.
     
    Regards,
    Eric
  •  02-17-2010, 3:48 AM 58751 in reply to 58719

    Re: Control customization

    Hello Eric,
     
    I read that, and managed to get a layout similar to what I need. There is still one (hopefully) last issue though.
     
    If you choose only one single file to upload, and hit the upload button, the queue table disappears completely during the upload,  and appears again when the upload finishes, showing the the green checkmark icon (uploadok.png).
     
    Now, if you choose another file (or if you choose two files at once in the beginning), the queue table does not disappear, but rather shows the progress rotating icon (uploading.gif) for the file being currently uploaded, and the remove icon for the rest of the files below.
     
    Can I change that behavior so that the queue table does not disappear even with a single file in the queue during uploading?
     
    Regards,
    Petros.
  •  02-17-2010, 5:48 PM 58768 in reply to 58751

    Re: Control customization

    After 3-4 hours of studying the uploader.js I found the NumFilesShowQueueUI property which, if set, gives me exactly the functionality I asked about in my previous post.
     
    The funny thing is that this property is NOT documented anywhere, nor is it part of any example... It isn't even programmed to receive any value in the include_phpuploader.php with let's say the following code:
    1. public $NumFilesShowQueueUI=1;  
    2. ...
    3. ...
    4. ...
    5. ...
    6. $code.=$this->_GenerateAttribute("NumFilesShowQueueUI"); 
     I wonder why is that so, and how is somebody supposed to know about this property...
  •  02-18-2010, 6:56 PM 58823 in reply to 58768

    Re: Control customization

    .
  •  02-21-2010, 5:46 PM 58872 in reply to 58823

    Re: Control customization

    One very simple and quick question. When I upload some files, and I haven't set from the beginning the $uploader->SaveDirectory property, nor have I used after the upload the $mvcfile->MoveTo method to move them to a desired location, WHERE do the files go?
  •  02-21-2010, 6:51 PM 58873 in reply to 58872

    Re: Control customization

    PrinceOfAbyss:
    One very simple and quick question. When I upload some files, and I haven't set from the beginning the $uploader->SaveDirectory property, nor have I used after the upload the $mvcfile->MoveTo method to move them to a desired location, WHERE do the files go?
     
    1. <?php require_once "phpuploader/include_phpuploader.php" ?>   
    2. <html>   
    3. <body>   
    4.         <form id="form1" method="POST">   
    5.             <?php   
    6.                 $uploader=new PhpUploader();   
    7.                 $uploader->Name="myuploader";    
    8.                 uploader->Render();   
    9.             ?>   
    10.         </form>   
    11. <?php   
    12. //Gets the GUID of the file based on uploader name   
    13. $fileguid=@$_POST["myuploader"];   
    14. if($fileguid)   
    15. {   
    16.     //get the uploaded file based on GUID   
    17.     $mvcfile=$uploader->GetUploadedFile($fileguid);   
    18.     if($mvcfile)   
    19.     {   
    20.         //Gets the name of the file.   
    21.         echo($mvcfile->FileName);   
    22.         //Gets the temp file path.   
    23.         echo($mvcfile->FilePath);   
    24.         //Gets the size of the file.   
    25.         echo($mvcfile->FileSize);    
    26.            
    27.         //Copys the uploaded file to a new location.   
    28.         $mvcfile->CopyTo("/uploads");   
    29.         //Moves the uploaded file to a new location.   
    30.         $mvcfile->MoveTo("/uploads");   
    31.         //Deletes this instance.   
    32.         $mvcfile->Delete();   
    33.     }   
    34. }   
    35. ?>  
    36. </body>   
    37. </html>  
     
    More information:
     

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View as RSS news feed in XML