|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have such a problem in my project.
PHP generates table and i have to save this table on user's machine in some type for example CSV. How it is possible to do in PHP to generate file and make it possible to download like usual file from url without using server's space. Thanx in advance |
|
#2
|
|||
|
|||
|
Below is the code I use to print onto a page which can be downloaded as csv file.
Make a new page called 'anythingyoulike.php'. Substitute your connection,recordset, fieldnames for your own. Make sure that your client knows that when saving to his/her computer, select 'text file' as the filetype option and not html - also name the file with extension .csv PHP Code:
Zalfreid - did you discover a way to save directly to computer? If so, would you share it here? Hope this helps you. |
|
#3
|
|||
|
|||
|
Dummy Zip Files download ok.
I wanted to find a way to create a zip or tar file at my site, with php, so that someone might download it, but i could not use exec(tar..) or system(tar...) because my host does not give me access, but I found a neat trick... if i rename any file as somefile.zip , then it automatically downloads, even though it is not a zip file
The user can click on a link to that dummy.zip file, or simply point their browser to http://somesite.com/dummy.zip , and it downloads |
|
#4
|
|||
|
|||
|
Different approach
Someone in IRC #phpfreaks channel just kindly gave me this link, though I have not tried it out.
http://www.sephiroth.it/phpwiki/ind...%20text%20files Description: When you need to send to the browser a 'text' (or .as, .sql, or php file too) base file but you don't want that the browser displays it in the output. If you want to allow browser ask to "save" the document use this php header (seems working also under netscape) the code: PHP Code:
Last edited by edwinbrains : June 6th, 2004 at 01:18 PM. Reason: [php] and [/php] added |
|
#5
|
||||
|
||||
|
Archemides: I added [php ] and [/php ] tags to that, just to make it easier to read.
|
![]() |
| Viewing: Dev Articles Community Forums > Programming > PHP Development > PHP: download PHP generated files |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|