Jump to content

How to download audio files from direcotry according to the id's from database in PHP?


Recommended Posts

I have a Joomla website having one folder for audio files in it and their links are saved in database.

Now I want to show two calendars to the user at front end, so that they can choose that from when to from he want to download the audio files?

for e.g he can select june-2-2014 in one calendar and august-2-2014 in second calendar, now on clicking download button the files residing between the two specific dates must get archived into one zip file and then start downloading...
 

i have a reference link for creating a zip and downloading the zip :http://coursesweb.net/php-mysql/create-zip-file-archive-php_cs

 

now i am stuck that how to get the selection of user from calendar , save it into the array , and from the array get the files from the folder matching the array indexes and then zip , download them.

 

please tell me how to achieve this task ?

now i am stuck that how to get the selection of user from calendar , save it into the array , and from the array get the files from the folder matching the array indexes and then zip , download them.

 

Thats all your stuck on? :)

 

Start with a calender.  Keep it client side with JS (jQueryUI has one). Now you have two dates in your form.

 

One option is to submit your form using Ajax.  Server then gets the two dates, validates them, and performs a query between those two dates.  The server then creates the zip file, and stores it in a tmp directory with a random name, and returns the name of the file to the client. The client then redirects to that file.  Consider a cron job to keep your temp folder from filling up.

 

Alternately, you could traditionally submit your form, and then stream back the file, but it will take more resources.

 

I am sure there are other ways to skin this cat.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.