Solved

How to download csv files from server

Posted on 2014-10-29
10
190 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

This article discusses how to create an extensible mechanism for linked drop downs.
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

749 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