SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Evangelist
    Join Date
    Dec 2006
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Putting uploaded files in a rar/zip file

    Hi Guys,

    when a user uploads a file , i was wanting it to be put in a zip/rar file first by php to make the uploads consistent on the server but i'm stuck on the mechanics of it, i have this so far:

    PHP Code:
         $filename_zip $renamed_file;
         
    $file_contents file_get_contents("uploads/$filename_zip"); 
         
    $createZip -> addFile("uploads/$file_contents$filename_zip");
         
    $the_zip_file "$filename_zip.zip"
    im getting this error:

    PHP Code:
    Fatal errorCall to a member function addFile() on a non-object 
    im probably way off lol , any help would be appreciated

    cheers

    Graham

  2. #2
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    Hi Graham
    I take it you have a class defined as $createZip? and in it their is a function called addFile.....?!

    Also the add file line looks a little suspect
    PHP Code:
    $createZip -> addFile("uploads/$file_contents$filename_zip"); 
    Should that be
    PHP Code:
    $createZip -> addFile("uploads/$file_contents""$filename_zip"); 
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  3. #3
    SitePoint Evangelist
    Join Date
    Dec 2006
    Posts
    430
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorted thanks spikeZ

    Graham


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •