Solved

How to download csv files from server

Posted on 2014-10-29
10
185 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
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 108

Expert Comment

by:Ray Paseur
ID: 40411503
0
 

Author Comment

by:jagguy
ID: 40412036
yes i need help with the code please
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 

Author Comment

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

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 42

Accepted Solution

by:
Rob Jurd, EE MVE 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
This article discusses four methods for overlaying images in a container on a web page
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

911 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now