0

hello....


i am doing one task. in that there is a number of products. each product have number of pdf files. i am adding these files from admin side and inserting in database. so how can i download particular product files(ex..10 files) in single press at frontside.

thnx.

Edited by muralikalpana: n/a

4
Contributors
17
Replies
18
Views
7 Years
Discussion Span
Last Post by saiprem
0

I would suggest sending the files as a zip and maybe find a class or library that can zip a group of files.

0

I would suggest sending the files as a zip and maybe find a class or library that can zip a group of files.

thanx. i think class is better automatically create gip for group of files for download. i am searching for that class. if you don't mind you have any idea about automatically gip when fetching files from database.

0

are you inserting PDF into database? I don't suggest you do that. I suggest you add them to the folder and add its path (Link) to the database

0

are you inserting PDF into database? I don't suggest you do that. I suggest you add them to the folder and add its path (Link) to the database

yaa i am doing same as you said. but here i am fetching filenames for download. fo example there is 10 files is there. evert time one file download.
so there is any chance to automaic gip to these group of files to download.

Edited by muralikalpana: n/a

0

It is possible to link to files in a database by using dynamic urls like the following.
page.php?file=test.pdf
Then you would use a mysql_query() on $_GET.

0

It is possible to link to files in a database by using dynamic urls like the following.
page.php?file=test.pdf
Then you would use a mysql_query() on $_GET.

sorry...explain briefly.

0

sorry...explain briefly.

I was just explaining to evstevemd how pdf files in a database can be retrieved just as easily as files in the filesystem. Not that it helps to solve your problem. ;)

0

That depends on whether they go to same folders or different folders. If they go to same folder then it is easy. Store only filename and retrieve with something like
HOME_DIR\folde_name\retrieve.php?filename=filename.pdf

but if they go to different folder then store folder name and filename
HOME_DIR\downloads\retrieve.php?foldername=foldername&filename=filename.pdf

Back to murali, what is the problem/ wall you are facing?

0

That depends on whether they go to same folders or different folders. If they go to same folder then it is easy. Store only filename and retrieve with something like
HOME_DIR\folde_name\retrieve.php?filename=filename.pdf

but if they go to different folder then store folder name and filename
HOME_DIR\downloads\retrieve.php?foldername=foldername&filename=filename.pdf

Back to murali, what is the problem/ wall you are facing?

yaa...i am using same folder.

actually there is number of products. each product have number of files(pdf, excel files). these files are storing one folder.
i am retriving these files using productid. then all the files download once which files containg that product.

0

yaa...i am using same folder.

actually there is number of products. each product have number of files(pdf, excel files). these files are storing one folder.
i am retriving these files using productid. then all the files download once which files containg that product.

Then you should zip them and give them one ID, of zipped file.
Otherwise, the IDs will differ and difficult will be the retrieval. or put them in same folder and refer them by folder name or folder ID

0

Then you should zip them and give them one ID, of zipped file.
Otherwise, the IDs will differ and difficult will be the retrieval. or put them in same folder and refer them by folder name or folder ID

you mean each product have a gip file. then how can i gip those files.
and i have another doubt for example admin once uploaded files after he added new files to that product. then how zip file updated.

0

you mean each product have a gip file. then how can i gip those files.
and i have another doubt for example admin once uploaded files after he added new files to that product. then how zip file updated.

Mhh! If you regularily update, zip isn't decent solution. Use folders then. But after time you will have gazillion of folders. But nice thing is you will manipulte the via interface.

So everytime you make new product, a script should make subdirectory in products DIR and give it next ID in the DB. Then it should insert in DB ID, Foldername and Filename, and may be alias (Nice name like Cadillac Specifications.pdf). To refer a produc, use url like: http://www.mysite.com/products.php?folder=321&filename=2354

Hope you get it :)

0

Mhh! If you regularily update, zip isn't decent solution.

I disagree. I would suggest getting php to automatically make the zip files just before downloading. I'm not sure how but there would be a way.

0

Mhh! If you regularily update, zip isn't decent solution. Use folders then. But after time you will have gazillion of folders. But nice thing is you will manipulte the via interface.

So everytime you make new product, a script should make subdirectory in products DIR and give it next ID in the DB. Then it should insert in DB ID, Foldername and Filename, and may be alias (Nice name like Cadillac Specifications.pdf). To refer a produc, use url like: http://www.mysite.com/products.php?folder=321&filename=2354

Hope you get it :)

can we download total folder at once. i am asking about folder which will have total files of that product.

0

I disagree. I would suggest getting php to automatically make the zip files just before downloading. I'm not sure how but there would be a way.

Hi Guys, Cwarn23 told right thing, make a zip file in runtime and send it to users for download.

If your server is in Linux, then making a zip file will be very easy....

Write a cron to delete those zip files once in a day.

The syntax for zip command is

zip -r destination.zip source_files1/*

and you just execute this command by using the function system() or exec() or passthru()...

Edited by saiprem: n/a

0

Better yet php has a zip library. Gotta love php.

Hi Guys, Cwarn23 told right thing, make a zip file in runtime and send it to users for download.

If your server is in Linux, then making a zip file will be very easy....

Write a cron to delete those zip files once in a day.

The syntax for zip command is

zip -r destination.zip source_files1/*

and you just execute this command by using the function system() or exec() or passthru()...

1

Better yet php has a zip library. Gotta love php.

Hi cwarn23,

I think it would be better to put execution burden on the Operating System than putting it on to the php script. And also I think linux zip command works much faster than compared to zip library of PHP.

So as per my suggestion using of linux command will be good, but I am not sure which one is best when it comes into execution.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.