Re: How to change a filename for download (e.g. jpeg, pdf etc.)

From: Date: Mon, 25 Jan 2010 10:52:48 +0000
Subject: Re: How to change a filename for download (e.g. jpeg, pdf etc.)
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-301407@lists.php.net to get a copy of this message
take a look at this : http://www.phpclasses.org/browse/package/3220.html On Mon, Jan 25, 2010 at 11:32 AM, Ashley Sheridan <ash@ashleysheridan.co.uk>wrote: > On Mon, 2010-01-25 at 10:03 +0000, SED wrote: > > > Hi, > > > > Can anyone point me to tutorials on how to change a filename for each > > download? My goal is to give the downloader a random name for a picture > or a > > document, so he will never know what the original filename is. > > > > Regards, > > Summi > > > > > > > > > > > I save the file using the temp filename given to it by PHP during the > upload process. If that's not possible, then some sort of hash (MD5 for > example) of the original file name would suffice. Then, when the user > requests that file, they have to request it with a URL like > file.php?file=hashname > > The added benefit of this is that you can verify the user is logged in > or not too. The only problem would be if you were serving media files, > as no plugins I know of send all the correct headers for the media file > request, so your browser would see it as an anonymous request. > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > >

« previous php.general (#301407) next »