Solved

How to download csv files from server

Posted on 2014-10-29
10
195 Views
Last Modified: 2014-11-28
Hi, I am using cakephp and I have created a few excel csv files stored on a server.
I want to be able to press a button on one of the webpages and download the whole folder of csv files from the server to my PC. How do I do this in php?
0
Comment
Question by:jagguy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
10 Comments
 
LVL 1

Expert Comment

by:gireeshbabu
ID: 40410707
I would suggest to make a zip of all the server folder with files and give a download.
0
 
LVL 19

Expert Comment

by:Montoya
ID: 40411281
You can run a script server side, that zips all your files, or adds the latest file to the zipped file,
from there all you need is a link on the other end to initiate a download. No code needed (except for the script to start the zip process). Do you need help with that?
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 40411503
0
Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

 

Author Comment

by:jagguy
ID: 40412036
yes i need help with the code please
0
 

Author Comment

by:jagguy
ID: 40412068
is there a way to do it without zipping the files?
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 40412080
press a button on one of the webpages and download the whole folder of csv files
I don't think you can do it in a single click unless you can make references to all of the files at once, and that's where Zip comes into play.  You might be able to set something up with an FTP client on your local machine, but it will not be something that can be triggered with a mouse click on the web page.  It's a security thing.  Imagine if a web site could download files to your machine without your explicit permission.  You don't want to go there!
0
 

Author Comment

by:jagguy
ID: 40414995
Either way unless i find code to do this I am just talking about without getting anything done.  I dont mind being pointed to a website provided it has complete code and not snippets.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 40424631
What part of "It's a security thing.  Imagine if a web site could download files to your machine without your explicit permission." do you not understand.  You are not going to find the code you are looking for because it would be necessary to bypass security to do it.  

You might find something on the darknet, but if you use it your site will very quickly be marked as dangerous by virtually every Anti-virus vendor on the planet. Plus a host that discovered it or got complaints about it would suspend your account to avoid liability.

Even if the server has no public access you probably will find that you are not likely to find a security admin in there right mind that would allow there servers to be used for such an operation.

Cd&
0
 
LVL 43

Accepted Solution

by:
Rob earned 500 total points
ID: 40425090
Cd& / Ray,

Not sure there is a security issue if jagguy owns the server?  The browser will of course have to handle the download.  You will of course not be able to bypass that.

jagguy,

It can ONLY be done with one file at a time, hence the ZIP suggestion.

As was stated before, you can only send one file at a time back to the client, which is why a zip file was suggested as you can zip up all the excel files in that folder and send that ONE file to the client.
0

Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question