FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » Downloading files, without internet renumbering...
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Downloading files, without internet renumbering... [message #169359] Wed, 08 September 2010 14:37 Go to previous message
jodleren is currently offline  jodleren
Messages: 7
Registered: September 2010
Karma:
Junior Member
Hi all

I have this simple script to download file frome anywhere. It gets a
parameter and passes the file on.
The problem is that files like ABC01234.nc works well.
Then someone adds a version to is to it becomes ABC01234.2.nc - the .2
got added causing my browser (?) to change it ABC01234[1].2.nc - the
[1] bothers me.

CanI get rid of that?

WBR
Sonnich

Code:

<?php

function ExtractFilename($filename)
{
if(strrpos($filename, '\\')===false)
return $filename;
else
return substr($filename, strrpos($filename, '\\')+1);
}

$file=$_GET['file'];
$filename=ExtractFileName($file);

header('Content-type: application/octet-stream');
header("Content-Disposition: attachment; filename=\"$filename\"");

readfile($file);
?>
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Php Switch Case
Next Topic: Re: Php code for ajax encoding
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 18:58:09 GMT 2024

Total time taken to generate the page: 0.04925 seconds