Y T Nuke  
Results 1 to 7 of 7
Hy, Im having a bit problem and wondered if anyone could help me! Anyways, I ...
  1. #1
    eestisiin's Avatar
    eestisiin is offline Regular Member
    Join Date
    Oct 2007
    Posts
    241
    Reputation
    16
    Thanks
    29
    Thanked 106 Times in 20 Posts

    Default Automatic Filename Generator - Help Me?!

    Hy,

    Im having a bit problem and wondered if anyone could help me! Anyways, I have a website where I will let people download different files, but the file content is always the same. I think I could get higher conversion rate if i could change the file name according to the download link.

    Example:

    At the moment i have example "Download SongName1" when person clicks it, he gets a file download.rar

    What I want is that when a person clicks "DOwnloads Songname!" then he would get the file SongName1.rar etc.

    The reason why im asking this is, that i dont want to have 200-300K files on my server and link them to each download page

    Im pretty sure that there must be a possibility to autogenerate file names

    Thanks in advance!

  2. #2
    eestisiin's Avatar
    eestisiin is offline Regular Member
    Join Date
    Oct 2007
    Posts
    241
    Reputation
    16
    Thanks
    29
    Thanked 106 Times in 20 Posts

    Default Re: Automatic Filename Generator - Help Me?!

    Help is still very much needed and I know that there must be a way to do it but how...

  3. #3
    lokiceo's Avatar
    lokiceo is offline Registered Member
    Join Date
    Jul 2008
    Location
    WI
    Posts
    77
    Reputation
    10
    Thanks
    14
    Thanked 28 Times in 17 Posts

    Default Re: Automatic Filename Generator - Help Me?!

    I could write you up a php script that copies the rar a bunch of times and renames it every time, though that would use up a ton of disk space, shoot me a PM, i'll help you out with this

  4. #4
    drkenneth's Avatar
    drkenneth is offline Executive VIP
    Join Date
    Nov 2008
    Location
    USA
    Posts
    285
    Reputation
    26
    Thanks
    20
    Thanked 167 Times in 79 Posts

    Default Re: Automatic Filename Generator - Help Me?!

    How big is the file your posting and how often is it being downloaded?

    You can have a PHP script serve up the file to the client, claiming the file name is anything you want. (Though consumes PHP server resources really fast depending on how many concurrent downloads are happening.)

    I'll see if I can throw together a quick demo...
    PHP Code:
    <?php
    //Don't allow the script to timeout
    set_time_limit(0);

    //Get local file path
    $file_path "./randomfile.rar";

    //Abort if the file does not exist
    if (!file_exists($file_path))
    {
        echo 
    "<h1><font color='red'>ERROR LOCATING FILE</font></h1>";
        die;
    }

    //Get the file size from the file system (database for display only)
    $file_size filesize($file_path);

    //The claimed filename (can be whatever you want... should match proper mime type.)
    $claimed_filename "smackthat.mp3";

    //Claimed MIME type--reference list of mime types for different files names at: http://www.feedforall.com/mime-types.htm
    $claimed_type "audio/mpeg";

    // Set transfer headers in browser
    header("Pragma: public");
    header("Expires: 0");
    header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
    header("Cache-Control: public");
    header("Content-Description: File Transfer");
    header("Content-Type: $claimed_type");
    header("Content-Disposition: attachment; filename=\"$claimed_filename\"");
    header("Content-Transfer-Encoding: binary");
    header("Content-Length: " $file_size);

    //Transfer the file via the script (impossible for user to see true location on server)
    $file = @fopen($file_path,"rb"); //Open file in binary mode
    if ($file)
    {
        while(!
    feof($file)) {
            print(
    fread($file1024*8)); //Transfer in 8kb chunks
            
    flush();
            if (
    connection_status()!=0) { //What to do if client terminates connection
                
    @fclose($file);
                die();
            }
        }
        @
    fclose($file); //Close the file at the end
    }
    ?>
    This is for some code I wrote earlier to protect the server location of files I was serving. (So people could not download them without being logged in + having proper credentials.) I modified it to suit your purpose--you modify the true file location, claimed type, and claimed name. You can have them based on whatever scripting information you want.

    Also, if you don't really care about them downloading a valid file you could just send some random data and claim it's a file... (Would use significantly less server resources.)
    Last edited by drkenneth; 02-25-2009 at 04:31 AM.
    -DrKenneth

  5. #5
    eestisiin's Avatar
    eestisiin is offline Regular Member
    Join Date
    Oct 2007
    Posts
    241
    Reputation
    16
    Thanks
    29
    Thanked 106 Times in 20 Posts

    Default Re: Automatic Filename Generator - Help Me?!

    thanks drkenneth

    Well, the problem is that the file is just a packed text file which suggest you to fill out some offer and etc. Just for example...

    But hmm, how much resource would it take and would it kill my connection? I mean there arent lots of downloads and I dont believe that there are any simultaneous downloads either.

    PS - Could you explain your script a bit more, im just a bit stupid here :/...

    File size is some 100kb or less

    Also - does anyone know how could I become an affiliate of such websites which allow people to download files when they pay for the sign up? Some Mp3 download sites and etc use it. Click here to download or Click Here to Download fast and it is somekind of affiliate link, but i have never searched it before and now I cant seem to locate one such website

  6. #6
    drkenneth's Avatar
    drkenneth is offline Executive VIP
    Join Date
    Nov 2008
    Location
    USA
    Posts
    285
    Reputation
    26
    Thanks
    20
    Thanked 167 Times in 79 Posts

    Default Re: Automatic Filename Generator - Help Me?!

    With a file of that size/traffic it would be fine. I just wanted to make sure it wasn't like a 10MB file downloaded every minute, haha.

    The script's comment explain what each individual part does, but I'll give you a brief summary of the overall idea.

    Basically, instead of simply linking the browser to a file on the server, you link them to a php script. This php script then opens the local file on your server, and then sends the browsers the proper headers the user would get if they were actually downloading a file of whatever type you want. The script then proceeds to read the file and output it to the web browser after the headers in 8kb chunks until it's complete or the user disconnects. Basically the identical process to them opening the file, except managed through the PHP script rather than the server only. This allows you to control the file name the browser believes they are downloading, the file type, etc.

    Also, in the case of a zip file you would want the "application/zip" MIME type in the script. (So the browser knows how to handle it.) You can script the file name ($claimed_filename) to be whatever you want based on a get string argument, post string, random, etc. etc.
    -DrKenneth

  7. #7
    Join Date
    Nov 2008
    Location
    IŽll check my GPS & tell you
    Posts
    263
    Reputation
    56
    Thanks
    95
    Thanked 199 Times in 113 Posts

    Default Re: Automatic Filename Generator - Help Me?!

    Quote Originally Posted by eestisiin View Post
    Also - does anyone know how could I become an affiliate of such websites which allow people to download files when they pay for the sign up? Some Mp3 download sites and etc use it. Click here to download or Click Here to Download fast and it is somekind of affiliate link, but i have never searched it before and now I cant seem to locate one such website
    Try searching for those SMS download gateway, I'm using one that is from Spain (sepomo.com) and your visitor send you a sms and receive the code to download the file.

AdStract


Advertise on Black Hat World

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
  SEnukeX SEO Software
Proudly Powered by Hostwinds.com Web Hosting Click Here For Exclusive BHW Discounts!

Cheap Web Hosting


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76