Jump to content


Photo

how to create a file on the server


  • Please log in to reply
3 replies to this topic

#1 neugi

neugi
  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 30 June 2006 - 05:46 PM

Hi,

i want to create a file on the server.

i know how to write into a file, but i cant remember how to create a file with php where i can write inside.

thx

#2 technode

technode
  • Members
  • Pip
  • Newbie
  • 6 posts

Posted 30 June 2006 - 06:05 PM

if the file already exists, resaving will overwrite what is there. Otherwise, open the file, dump he data into a variable and add the new information to the end and resave.

#3 neugi

neugi
  • Members
  • PipPipPip
  • Advanced Member
  • 63 posts

Posted 30 June 2006 - 06:09 PM

Hi,

i need to create a new file. there is no existing file where i can write into ;)

best

#4 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 30 June 2006 - 07:02 PM

It may sound confusing, but fopen() is used to create files.
if you write:
fopen("something.txt","w");
And something.txt doesnt exsist, it'll try to create it.

Note that the file will be created only using the modes w, w+, a and a+.

For more information, check fopen()

Orio.
Think you're smarty?

(Gone until 20 to November)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users