Processing Uploaded Files with PHP

Last post 01-25-2013, 1:23 PM by Kenneth. 2 replies.
Sort Posts: Previous Next
  •  01-24-2013, 7:59 PM 76729

    Processing Uploaded Files with PHP

    First of all, let me apologize for my ignorance here. I work a lot with PHP, but hardly at all with Javascript/Ajax, etc. I love your uploader, and have got it working using a simple upload process.

     

    However, I plan to use it to upload images to the gallery section of our site.  I currently have a PHP script that I run on single image uploads that resizes the uploaded image, creates a thumbnail and saves the thumbnail and resized image to our gallery directories.

     

    I'm completely baffled at how to get the php uploader to allow my admins to upload multiple files, but then run my usual script on each of the uploaded files. I've looked through the example files that came in the zip file, but since they aren't commented and since I don't really understand Javascript/Ajax very well, I am fumbling blind with how to make this work.

     

    Any guidance or direction you can provide would be immensely appreciated. 

  •  01-25-2013, 1:20 PM 76737 in reply to 76729

    Re: Processing Uploaded Files with PHP

    ..
  •  01-25-2013, 1:23 PM 76738 in reply to 76729

    Re: Processing Uploaded Files with PHP

    Hi BlackAce,

     

    First, you can refer to the document at http://phpfileuploader.com/document/

     

    To retrieving the uploaded file, save to your server, change file name Etc, please refer to http://phpfileuploader.com/document/scr/Deployment.htm step 3, it shows you how to handle the upload file store location and the file name after uploaded, so you can save the file there and generate the thumbnail.

     

    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. ?>  
     

    To upload multiple files at a time, just need to set $uploader->MultipleFilesUpload=true; 

     

    Regards,

     

    Ken 

View as RSS news feed in XML