Qanday qilib men foydalanuvchini yuklab olish uchun ZIP fayllarni tanladim?

Stackoverflow'dagi birinchi lavozimim, shuning uchun iltimos, menga biror narsa noto'g'ri ekanligini bilishimga imkon bering, shunda rahmat.

Mening saytimda quyidagi kod bor ...

<table id="fruits">
    <tbody>
        <tr class="file" id="tr-file">
            <td class="name" id="id1">NAME-OF-FILE1</td>
            <td class="name" id="id2">NAME-OF-FILE2</td>
            <td class="name" id="id3">NAME-OF-FILE3</td>
            <td class="name" id="id4">NAME-OF-FILE4</td>
        </tr>
    </tbody> 
</table>

I know I can zip the files in cpanel or upload the files zipped and put it as a link in the page... But I want the visitor to choose which files they want to download, no force them to download all 4 files. So I searched in Google and found a useful post. (THE PROBLEM IS THAT I JUST KNOW THE BASIC OF HTML, I dont understand what he wrote) I want the visitor to select multiples files from <table id="fruits">.

Example: http://jsfiddle.net/dn3L7/

 <table id="fruits">
        <tbody>
            <tr class="file" id="tr-file">
               <input type"checkbox" id="idc1"> <td class="name" id="id1">NAME-OF-FILE1</td>
               <input type"checkbox" id="idc2"> <td class="name" id="id2">NAME-OF-FILE2</td>
               <input type"checkbox" id="idc3"> <td class="name" id="id3">NAME-OF-FILE3</td>
               <input type"checkbox" id="idc4"> <input type"checkbox" id=""idc1>  <td class="name" id="id4">NAME-OF-FILE4</td>
            </tr>
        </tbody> 
    </table>

When they finish checking the files they will be able to click a button to download the zip file.

2
Tegishli xabarlar: fayllarni php-da zip sifatida yuklab olishingiz mumkin stackoverflow.com/ savollar/1754352 /; hellip;
qo'shib qo'ydi muallif Samuel Liew, manba
Bu, ehtimol, ortiqcha toshqin uchun juda katta savol, siz asosan odamlar uchun ilovani yozishingizni so'rayapsiz. Shakllarni qanday qilishni, kiritishni qayta ishlashni, zip faylini yaratish va unga yo'naltirishni o'rganishingiz kerak bo'ladi. Ehtimol, siz savolni kichikroq qismlarga ajratsangiz.
qo'shib qo'ydi muallif Gringo Suave, manba

1 javoblar

ZipArchive ga qarashingiz mumkin. bu bilan zips yaratish va foydalanuvchini yuklab olish imkonini beradi.

Cletus juda yaxshi javob beradi u erda . Men bu namunani kamtarlik bilan bu erga ko'chiraman

$files = array('readme.txt', 'test.html', 'image.gif');
$zip = new ZipArchive;
$zip->open('file.zip', ZipArchive::CREATE);
foreach ($files as $file) {
  $zip->addFile($file);
}
$zip->close();

va uni oqimlash uchun:

header('Content-Type: application/zip');
header('Content-disposition: attachment; filename=filename.zip');
header('Content-Length: ' . filesize($zipfilename));
readfile($zipname);
3
qo'shib qo'ydi
PHP ning birinchi satrida name = "files []" belgisini qo'ying: $ files = $ _GET ['files']
qo'shib qo'ydi muallif Samuel Liew, manba
Samuel Liew "tasdiqlash qutisi" ni qanday yaratishni bilasizmi? savolni qanday izohlayman, chunki men foydalanuvchini barcha fayllarni yuklab olishga majburlamayman.
qo'shib qo'ydi muallif Dominicanstan, manba
Javascript UZB
Javascript UZB
99 ishtirokchilar

@js_uzb @vuejs_uz @react_uz @nodejs_uz @angular_uz @ngTashkent @yiiframework_uz @laravel_uz @linux_uzbek @python_uz @swift_uzb —————— @uzdevgroup @UzGeeksGroup ——— @UzDev_Jobs @jobs_uzb

PhP |BotsUz
PhP |BotsUz
93 ishtirokchilar

Phpni o'rganishni Hohlasangiz https://t.me/joinchat/AAAAAE-KRc5dd5tPMmGmWA A'zo bo'lin