Can't Find the file

Last post 08-21-2009, 1:04 AM by cutechat. 10 replies.
Sort Posts: Previous Next
  •  07-09-2009, 12:33 PM 53869

    Can't Find the file

    Downloaded the demo and installed it on the server..  Everything seems to work fine EXCEPT I cannot find the file on the server.  How do I tell it where I would like the file stored.  The site is opertational
     
    www.imaginationprinting.com  in the menu click upload
  •  07-09-2009, 10:06 PM 53877 in reply to 53869

    Re: Can't Find the file

    Hi,
     
    The file is saved to server temp directory. maybe /tmp/ajaxuploader/
     
    Our standard sample do not copy the files to application folder.
     
    But the FileManager sample does.
     
    Please check the FileManager sample , and check the /filemanagerfolder/guest/
     
    You need also check the misc-filemanager-handler.php , it copy the temp file to the /guest/ folder
     
    Regards,
    Terry
     
  •  08-08-2009, 8:24 PM 54578 in reply to 53877

    Re: Can't Find the file

    I had the same issue. You need to document how to control where the files are downloaded!
     
    The page that gives the deployment examples, http://phpfileuploader.com/Deployment.html should be fixed to say in the "3. Retrieving uploaded file." section what the name of the php file that receives the file should be.
     
    Also, it should document how to pass parameters so the receiving program knows what to do with the uploaded file!
  •  08-08-2009, 8:38 PM 54579 in reply to 54578

    Re: Can't Find the file

    Hi,
     
    Please check our examples source code.
     
    It show you how to get the file.
     
    You can use
     
    $mvcfile=$uploader->GetUploadedFile($fileguid);   
     
    to get the file anywhere.
     
    and the $fileguid is just the value of the uploader hidden field.
     
    ---
     
    For parameters, I suggest you use Session, because it's a security thing.
     
    Regards,
    Terry
  •  08-14-2009, 2:01 PM 54698 in reply to 54579

    Re: Can't Find the file

    I am still confused. I am currently using a single file loader and would like to switch to this PHP loader in order to be able to load multiple files.
     
    In the other loader there is a  php program that comes with it that is executed when the file reaches the server. In that program you can add your own code to move the downloaded file to the place that you want. Also, they give you a method to add variables that are accesible to the receiving program, so it can place the file in the right place.
     
    My scenario: a user clicks to download a picture. I pass the name of this user to the loader so it knows where to copy this file (I would like to keep one single copy of the loader in the server.) Can this be done with the loader?
     
    What is the name of the php program that gets executed in the server to receive the file?
     
    Thanks! 
  •  08-17-2009, 7:25 AM 54737 in reply to 54698

    Re: Can't Find the file

    Hi,
     
    You need know our uploader is difference .
     
    Other uploader :
        yourcode -> parameter -> uploader -> target folder
     
    CuteSoft uploader :
        yourcode -> uploader -> yourcode ->target folder
     
    That means , our uploader do not upload file to your application folder. It will uploader the file to a temp place , and return a 'guidlist' , And then your code will continue be executed , and use the 'guidlist' to get the file object, and move the file to anywhere you want.
     
    Other uploader like an application , but CuteSoft uploader is a control .
     
    Regards,
    Terry
  •  08-17-2009, 2:16 PM 54743 in reply to 54737

    Re: Can't Find the file

    Ok, so can you be more specific on how to get the 'guidlist'?
     
    In the deployment page you give an example, but don't say what is the name of that file! I guess I need to create a file with that code and then I can customize it, right?
     
     3. Retrieving uploaded file.
    1. <?php   
    2. //Gets the GUID of the file based on uploader name   
    3. $fileguid=@$_POST["myuploader"];   
    4. if($fileguid)   
    5. {   
    6.     //get the uploaded file based on GUID   
    7.     $mvcfile=$uploader->GetUploadedFile($fileguid);   
    8.     if($mvcfile)   
    9.     {   
    10.         //Gets the name of the file.   
    11.         echo($mvcfile->FileName);   
    12.         //Gets the temp file path.   
    13.         echo($mvcfile->FilePath);   
    14.         //Gets the size of the file.   
    15.         echo($mvcfile->FileSize);    
    16.            
    17.         //Copys the uploaded file to a new location.   
    18.         $mvcfile->CopyTo("/uploads");   
    19.         //Moves the uploaded file to a new location.   
    20.         $mvcfile->MoveTo("/uploads");   
    21.         //Deletes this instance.   
    22.         $mvcfile->Delete();   
    23.     }   
    24. }   
    25. ?>  
  •  08-20-2009, 10:46 AM 54855 in reply to 54743

    Re: Can't Find the file

    I have finally figured the answer: both the Ajax control and the code to move the uploaded file reside in the same file!!!!
     
    Why couldn't you just say so? 
    1. <?php require_once "phpuploader/include_phpuploader.php" ?>
    2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    3. <html xmlns="http://www.w3.org/1999/xhtml">
    4. <head>
    5. <title>
    6. Form - Multiple files upload
    7. </title>
    8. <link href="demo.css" rel="stylesheet" type="text/css" />
    9. <script type="text/javascript">
    10. function CuteWebUI_AjaxUploader_OnPostback() {
    11. //submit the form after the file have been uploaded:
    12. document.forms[0].submit();
    13. }
    14. </script>
    15. </head>
    16. <body>
    17. <div class="demo">                        
    18.         <h2>Selecting multiple files for upload</h2>
    19. <p>PHP File Uploader allows you to select multiple files and upload multiple files at once.</p>
    20. <!-- do not need enctype="multipart/form-data" -->
    21. <form id="form1" method="POST">
    22. <?php

    23. $uploader=new PhpUploader();
    24. $uploader->MaxSizeKB=10240;
    25. $uploader->MultipleFilesUpload=true;
    26. $uploader->Name="myuploader";
    27. $uploader->InsertText="Select multiple files (Max 10M)";
    28. $uploader->Render();

    29. ?>
    30. </form>
    31. <br/><br/>
    32. <?php
    33. $fileguidlist=@$_POST["myuploader"];
    34. if($fileguidlist)
    35. {

    36.                         $docRoot = $_SERVER['DOCUMENT_ROOT'];//used for reading files
                              $userName 
                              $dir = "$docRoot/$userName/"; 
       
    37. $guidlist=split("/",$fileguidlist);
    38. echo("<div style='font-family:Fixedsys;'>");
    39. echo(count($guidlist));
    40. echo(" files Uploaded:");
    41. echo("</div>");
    42. echo("<hr/>");
    43. foreach($guidlist as $fileguid)
    44. {
    45. $mvcfile=$uploader->GetUploadedFile($fileguid);
    46. if($mvcfile)
    47. {
    48. echo("<div style='font-family:Fixedsys;border-bottom:dashed 1px gray;padding:6px;'>");
    49. echo("FileName : ");
    50. echo($mvcfile->FileName);
    51. echo("<br/>FileSize : ");
    52. echo($mvcfile->FileSize);
    53. echo("<br/>FilePath : ");
    54. echo($mvcfile->FilePath);
    55. echo("</div>");
    56. //Moves the uploaded file to a new location.
    57. $mvcfile->MoveTo("$dir");

    58. //Copys the uploaded file to a new location.
    59. //$mvcfile->CopyTo("/uploads");
    60. //Deletes this instance.
    61. //$mvcfile->Delete();
    62. }
    63. }
    64. }
    65. ?>
    66. </div>
    67. </body>
    68. </html>

     Also, I had trouble moving the file to a relative location, so I am showing the code (in yellow) that I added to get an absolute location for the file. Even though the control POSTs the data, notice that you can add your own parameters as GET parameters.
     
     
  •  08-20-2009, 10:49 AM 54856 in reply to 54855

    Re: Can't Find the file

    you can get the userName parameter as:
     
    $userName = $_GET['userName'];
     
    if you sent it as a GET parameter (thta line got messed up in my previous post...)
  •  08-20-2009, 10:51 AM 54858 in reply to 54856

    Re: Can't Find the file

    You probaly want to make that move to:
     
    $mvcfile->MoveTo("$dir/$mvcfile->Filename"); 
  •  08-21-2009, 1:04 AM 54883 in reply to 54858

    Re: Can't Find the file

    Hi,
     
    Yeah.. you have found the code to write your implementation :)

    Regards,
    Terry
     
View as RSS news feed in XML