| | |
Need help in create file php
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Mar 2006
Posts: 2
Reputation:
Solved Threads: 0
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
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
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
[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
•
•
Join Date: Mar 2006
Posts: 2
Reputation:
Solved Threads: 0
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
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
![]() |
Similar Threads
- How we open a ms word document file with php? (PHP)
- How to upload a file in PHP ? (PHP)
- submiting info into a database for retrieval! (PHP)
- Email piping to script problem (PHP)
- installing php admin in dreamweaver? (MySQL)
- How to write the new line existing pdf file using php (PHP)
- Output to text (notepad) file (HTML and CSS)
- i want to know how to create a file maintenance using visual basic 6.0 (Computer Science)
Other Threads in the PHP Forum
- Previous Thread: Need help with the syntax problem
- Next Thread: login scripts
Views: 2454 | Replies: 1
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary broken cakephp checkbox class cms code cron curl database date directory display download dynamic echo email encode error file files folder form forms function functions google howtowriteathesis href htaccess html image include insert integration ip java javascript joomla jquery limit link login loop mail menu methods mlm mod_rewrite multiple multipletables mysql oop parse paypal pdf php problem provider query radio random recursion regex remote script search select server sessions sms soap source space speed sql structure syntax system table template tutorial update updates upload url validation validator variable video web xml youtube





