Search found 7 matches
- Thu Aug 20, 2009 2:27 pm
- Forum: PHP - Code
- Topic: File Size for Linked File - line breaks
- Replies: 0
- Views: 191
File Size for Linked File - line breaks
Hello, I'm using the following code to generate a filesize for a linked file: <?php $file_type = array( 'K', 'M', 'G' ); $size = filesize ( $f ); for ( $t = 0; $size > 1024; $t++ ) { $size /= 1024; $file_size = round ( $size, 1 ) . ' ' . $file_type[ $t ] . 'B'; } $file_name = substr...
- Thu Aug 06, 2009 7:56 am
- Forum: PHP - Code
- Topic: File Size for Linked File
- Replies: 5
- Views: 244
Re: File Size for Linked File
Hello, I'm trying to keep the link to the file as simple as possible due to other people involved in possibly editing the page. I don't need an absolute reference to the file (answering previous post in this thread). The script is working fine for files in the current directory, but not for any file...
- Thu Aug 06, 2009 6:51 am
- Forum: PHP - Code
- Topic: File Size for Linked File
- Replies: 5
- Views: 244
Re: File Size for Linked File
Hello, Thanks for your quick reply. What am I doing wrong here? <?php $path = "/home/fhlinux13/l/mydomain.co.uk/user/htdocs/"; $f = basename($path); function splitFilename($f) { $pos = strrpos($f, '.'); if ($pos === false) { // dot is not found in the filename return ...
- Thu Aug 06, 2009 6:18 am
- Forum: PHP - Code
- Topic: File Size for Linked File
- Replies: 5
- Views: 244
File Size for Linked File
Hello, I have put together a script that will show the file size of a linked file (e.g. <a href="myfile.pdf" title="30.7 Kb">My File</a>). I have got it working to show the link and the file size, but I need some help to hide the file's location as it's working on an absolute ref...
- Tue Jul 28, 2009 10:54 am
- Forum: PHP - Code
- Topic: Listing files but hiding directories
- Replies: 3
- Views: 97
Re: Listing files but hiding directories
Thanks for letting me know.
Mark
Mark
- Tue Jul 28, 2009 2:39 am
- Forum: PHP - Code
- Topic: Listing files but hiding directories
- Replies: 3
- Views: 97
Re: Listing files but hiding directories
Hello,
Thanks for the quick reply. Can you point me where I should include this in the script? Every time I've tried to do it, either I come up with an error or it ignores the extra code entirely.
Mark
Thanks for the quick reply. Can you point me where I should include this in the script? Every time I've tried to do it, either I come up with an error or it ignores the extra code entirely.
Mark
- Tue Jul 28, 2009 2:20 am
- Forum: PHP - Code
- Topic: Listing files but hiding directories
- Replies: 3
- Views: 97
Listing files but hiding directories
Hello, I'm trying to get a script working which will write a list of links to files within any directory the script is dropped into, but following these criteria: a) Certain file extensions should be hidden (e.g. no *.gif files showing) b) Some files should be filtered using DOS */? criteria (e.g. c...