Author Topic: how create new file php  (Read 8625 times)

Offline ayoub

  • Jr. Member
  • **
  • Posts: 11
how create new file php
« on: July 30, 2009, 05:53:17 AM »
I am currently developing a plugin
the problem is that I need to create a file
I tried this code:

 $a = 'hello friend';
   //$tmpfname = touch('/home/user/file.txt');
   $fp = fopen("/home/user/file.txt", "a");
   fwrite($fp,$a);
   fclose($handle);

but the problem is not resolved
Can you  help me please
thks

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
how create new file php
« Reply #1 on: July 30, 2009, 07:23:04 AM »
file_put_contents("/home/user/file.txt", $a);
Regards,
Rosali
__________________
MyRoundcube Project (commercial)

Offline ayoub

  • Jr. Member
  • **
  • Posts: 11
how create new file php
« Reply #2 on: July 31, 2009, 03:46:14 AM »
thks
but the problem that the file is not created

Offline rosali

  • Hero Member
  • *****
  • Posts: 2,533
how create new file php
« Reply #3 on: July 31, 2009, 03:47:43 AM »
Check folder permissions. Code is ok. This is not a php support forum.
Regards,
Rosali
__________________
MyRoundcube Project (commercial)