I have a question with x10media

Discussion in 'PHP' started by johnatan46, Aug 24, 2008.

  1. #1
    Hi, i have my web and is www.mimp3.net in this web you can download, listen mp3 for free. But i want know how a can do for when you download a song the song rename, example:

    The name of the song is Aerosmith - Jaded.mp3

    And i want what automactly the file rename to

    Aerosmith - Jaded - www.mimp3.net.mp3

    Somebody knows how make this?

    Thank you, im wait the answer
     
    johnatan46, Aug 24, 2008 IP
  2. Steve136

    Steve136 Peon

    Messages:
    240
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hi,

    You could make a PHP script to rename all your songs in your directory and just serve them with the name already changed.

    or you can change the name "on-the-fly" with PHP - an example function:

    
    	function RenameSong($oldName, $newName)
    	{
    		if(isset($oldName) && isset($newName))
    		{
    			if(rename($oldName, $newName))
    			{	
    				//Carry on with the serving the download
    				//Present the $oldName variable link to the client
    				return true;
    			}
    			else
    			{
    				//Renaming failed
    				return false;
    			}
    		}
    	}
    
    PHP:
    of course asuming that the download is not a static link on a page. Hope it helped a bit,

    PS. More on PHP renaming on PHP .net

    Regards,

    Steve
     
    Steve136, Aug 24, 2008 IP
  3. CGSS-CyberGeek

    CGSS-CyberGeek Peon

    Messages:
    34
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi,

    My question is are you just wanting to rename the file/mask the filename when it is downloaded OR completely rename the file on the server?

    Depending on what you want to do, there are different ways to do this. Reply, and I will be able to assist you.
     
    CGSS-CyberGeek, Aug 24, 2008 IP
  4. johnatan46

    johnatan46 Banned

    Messages:
    674
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Hi, thank for your answer. This script was made is the song is buffering in the server and is downloading between is buffering. I thing thats is possible change the name before start download.

    Sorry is understandme, but im from mexico and i dont know very well the english. If you need more information, please tellme.

    thank you
     
    johnatan46, Aug 24, 2008 IP
  5. kip

    kip Notable Member

    Messages:
    1,521
    Likes Received:
    80
    Best Answers:
    0
    Trophy Points:
    205
    #5
    Change the $name variable. Should be able to add

    $name .= " - http://www.google.com";

    This will add a link at the end of name, I haven't tested it, but you can try that. function_list.php should be the place to add it.

    Once again I haven't tested it, and http://www.x10media.com/forums may result in better answer.
     
    kip, Aug 25, 2008 IP
  6. johnatan46

    johnatan46 Banned

    Messages:
    674
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Hi, thank you KIP for your andswer. Im post in the forum of x10media. I dont know in what line especifictly i need add this, im wait answer. Thank you.
     
    johnatan46, Aug 25, 2008 IP
  7. kip

    kip Notable Member

    Messages:
    1,521
    Likes Received:
    80
    Best Answers:
    0
    Trophy Points:
    205
    #7
    kip, Aug 25, 2008 IP
  8. johnatan46

    johnatan46 Banned

    Messages:
    674
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Very thank you kip, working perfects. Very thank you
     
    johnatan46, Aug 26, 2008 IP
  9. kip

    kip Notable Member

    Messages:
    1,521
    Likes Received:
    80
    Best Answers:
    0
    Trophy Points:
    205
    #9
    Your very welcome, glad it worked out ;)
     
    kip, Aug 26, 2008 IP