Solved

How to download csv files from server

Posted on 2014-10-29
10
182 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:Iammontoya
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
SSH (Secure Shell) - Tips and Tricks As you all know SSH(Secure Shell) is a network protocol, which we use to access/transfer files securely between two networked devices. SSH was actually designed as a replacement for insecure protocols that sen…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…

760 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

20 Experts available now in Live!

Get 1:1 Help Now