Page 1 of 1

File Management?

Posted: Thu Oct 31, 2002 9:24 am
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

Posted: Thu Oct 31, 2002 9:39 am
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.

Posted: Thu Oct 31, 2002 9:41 am
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.

Posted: Thu Oct 31, 2002 9:50 am
by twigletmac
How about using PHP's FTP functions:
http://www.php.net/manual/en/ref.ftp.php

Mac

Posted: Thu Oct 31, 2002 9:56 am
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