Zubrag.com
May 20, 2012, 11:08:47 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: force download of files with different extension  (Read 4564 times)
sosaited
Newbie
*
Posts: 9


« on: June 27, 2007, 05:11:06 am »

Hi.

I am very thankful for the admin/developers for this script, though I reall need a bit help on it. Can you please tell how to edit the script to add this function:

The files on the server or directory are without extensions, but when the Smart file Download executes a download, the downloaded file should have the associated extension (set in the script).

Thanks

Logged
zubrag
Administrator
Hero Member
*****
Posts: 753


WWW
« Reply #1 on: June 27, 2007, 09:34:16 am »

Can be done via "fc" parameter. Does it help?

download.php?f=phptutorial&fc=phptutorial123.zip
Logged
sosaited
Newbie
*
Posts: 9


« Reply #2 on: June 27, 2007, 02:15:50 pm »

I've already tried it. It works perfect. THOUGH, I need to keep files on the server with NO EXTENSION, and if I call files without extension, It gives an error. Can you please help me how to add an empty allowed extension.

Also, can you please tell a way, by which the download source path (or FROM field in FireFox Download window), will show JUST THE DIRECTORY PATH IN WHICH THE PHP SCRIPT WAS LOCATED, instead of the whole calling command.

Thanks
Logged
zubrag
Administrator
Hero Member
*****
Posts: 753


WWW
« Reply #3 on: June 29, 2007, 04:07:46 pm »

Following should allow downloading files with zip extension, and without extension.

  'zip' => 'application/zip',
  ''    => 'application/octet-stream',

Does this work for you?

I'm not sure I understood your second request correctly. Do you want to hide some part of the FROM field in Firefox's download window? Unfortunately I do not know how to achieve that (if that is possible at all).
Logged
sosaited
Newbie
*
Posts: 9


« Reply #4 on: June 30, 2007, 12:55:03 am »

Yes that works for me. Thank you vey much. I am using fc parameter to save as a different extension.

And I meant not hiding ALL the from field, just NOT SHOWING THE CALLED PHP COMMAND (www.domain.com/download.php?f=file.txt&fc=new.txt). I believe this is possible.
 Thank you
Logged
zubrag
Administrator
Hero Member
*****
Posts: 753


WWW
« Reply #5 on: July 02, 2007, 07:23:26 am »

Not sure. This depends only on browser, and I believe there is no way to control this string from php.

What exactly you are trying to achieve? Allow download for members only? Password protect it?

Maybe protecting downloads with password would help?
Logged
sosaited
Newbie
*
Posts: 9


« Reply #6 on: July 02, 2007, 11:00:47 am »

Honestly speaking, I myself am not sure what I am try to doi  Grin just kidding.

What I want to do, is to HIDE the "f" parameter given to the script, if some hacker/leecher etc etc knows the filename (even without extension) it is easy for him to search for direct link etc. I've heard of things like mod_rewrite etc. But i am unfamiliar with them. OR alternatively, if there was a way, to make this work:
Code:
.... download.php?f=fdcu39sdu&fc=5sd8al0.4a2

which will then force the download of song SPECIFIC TO THE ID "fdcu39sdu" and save it to specifi filename to  "5sd8al0.4a2"

I am not familiar with PHP, but i am familar with programming in general. (have to start learning PHP soon though). reading your script, I can guess that SOMETHING like this MIGHT work:

Code:
$search = $_GET['f'];

if ($search = "fdcu39sdu")
    $original = "Some file name";
else if ($search = "d58dasf45")
    $original = "Otherfile etc";
......

So can you please help on this .

Thanks
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC