• Help with PHP listing

    Miranda65M Member

    a web page that users can upload pdf, doc on it with entering title, keywords, category with it.
    Also there is a search page that user cansearch them.

    A search page and listingthe result.
    every row has 1 checkbox .
    what i want to do i want to if user will check the checkbox ( if only 1 selected that file will be – if more than 1, they willbe zip or rar(archive) ) they will be downloaded with pressing download button.

    There will be select all button ( for result of the search ) also which i coulnt add it here.

    
     
    
    
    

     

    Search results for

     

    ID Title Keyword Author Category FileName
  • GloriaFine Member

    I want to understand exactly what you are doing. I will explain what I am thinking and you tell me if I am correct.

    1. You want a listing with a checkbox by each row.
    2. The user checks box for every file he/she wants?
    3. when they hit download, the script will zip all the files into a single zip file and serve it for download?

    If this is what you are wanting, try this. What the below code does is take your files that are sitting on your server and takes the files listed in the variables and creates a single zip file containing all the files that were submitted to it on your server. it will then email the download link to the email address entered by the user as well as a second email to you saying they were sent.

    This is just a quick throw together so you might need to do a bit of tweaking on it to make it work for you but this is my impression of what you are wanting.

    $todelete = time();
    
    $nfile = './dfiles/' . $todelete . '.zip';
    
    $zip = new ZipArchive;
    foreach ($files as $file) {$zip->open($nfile, ZipArchive::CREATE);
    
      $zip->addFile('files/' . $file) ;
    }
    $zip->close();
    
    mail("$email", "Your download links from hiho.com", "Thank you for your purchase from hiho.com.
    The link to download your file is below (If you ordered any downloads).  Please remember that you have approximately 48 hours before the link becomes invalid.
    If this happens and you need to redownload the file you may send an email to admin@hiho.com to reactivate the link.
    Please include the items purchased as well as the items purchased.
    
    Your Download Link:
    http://hiho.com/dfiles/" . $todelete .  ".zip", "FROM: admin@hiho.com");
    if($row['notify_sale'] == 1){
    //mail("woohoo@txt.att.net", "Online sale.", "You just made //an online sale. The following items were sold. $list", "FROM: //adminb@hiho.com");
    }
    
Viewing 1 reply thread
  • You must be logged in to reply to this topic.
en_USEnglish