File Management?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Rob_Beard
Forum Newbie
Posts: 23
Joined: Sat Oct 12, 2002 11:58 am

File Management?

Post by Rob_Beard »

Hey all,

I'd like to know how i can download files, ie. PHP files, but actual source, rather than the code shown after the server side bit.

Also, how do i rename files? is it just a straight copy(filename, newfilename)? or a little more complex?

and just to check...is this ALL you have to do to delete a file???

unlink("filename");

Cheers

Rob
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

are you saying you want to download other peoples php source (i.e. the code used to display this post: viewtopic.php)? if so then you can't. webservers are designed to prevent this.
Rob_Beard
Forum Newbie
Posts: 23
Joined: Sat Oct 12, 2002 11:58 am

Post by Rob_Beard »

no, i'm saying i want to make a file manager. where users can download files placed in their particular directory.


i didnt make it clear enough. i mean, i want to make a PHP script that will download files. if any of you have used brinkster, there is a way to do it in ASP.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

How about using PHP's FTP functions:
http://www.php.net/manual/en/ref.ftp.php

Mac
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Code: Select all

header('Content-type: application/octet-stream');
header('Content-disposition: atachment; filename='.$filename);
readfile($path.$filename);
or http://www.php.net/manual/en/ref.zlib.php and application/zip | application/x-gzip
Post Reply