Need help in create file php

Reply

Join Date: Mar 2006
Posts: 2
Reputation: proto is an unknown quantity at this point 
Solved Threads: 0
proto proto is offline Offline
Newbie Poster

Need help in create file php

 
0
  #1
Mar 28th, 2006
hello

i was creating a script who will read a text file and create mp3 files from lines name , but i had a problem , php wont write php files it give me this warnning message

Warning: rename(0.txt,Aa Gale Lag Ja - Tera Mujhse Hai .mp3): Invalid argument in c:\gamesrecord\000\mpror.php on line 21
this is my code :

[PHP]
<?php
$lines = file('file.txt');
$l_count = count($lines);

for($x = 0; $x< $l_count; $x++)
{
$po = $lines[$x] ;
$ourFileName = "$x.txt";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fclose($ourFileHandle);

rename("$x.txt","$po.mp3");


echo $ourFileName ;

}


?>[/PHP]

pls help
and thank you
Reply With Quote Quick reply to this message  
Join Date: Mar 2006
Posts: 2
Reputation: proto is an unknown quantity at this point 
Solved Threads: 0
proto proto is offline Offline
Newbie Poster

Re: Need help in create file php

 
0
  #2
Mar 28th, 2006
hahaah i have solution , the problem was the blanc space , i used a php function who delete it rtrim("$file");

so the code is :

[PHP]<?php
$lines = file('file.txt');
$l_count = count($lines);

for($x = 0; $x< $l_count; $x++)
{
$po = $lines[$x] ;
$ourFileName = "$x.txt";
$ourFileHandle = fopen($ourFileName, 'w') or die("can't open file");
fclose($ourFileHandle);
$mo = rtrim("$po");
rename("$x.txt","$mo.mp3");


echo $ourFileName ;

}


?>
[/PHP]


have a good day

now lets create the fake mp3s file
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 2454 | Replies: 1
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC