Bestand maken

Status
Niet open voor verdere reacties.

Fred4Gille

Gebruiker
Lid geworden
15 mrt 2007
Berichten
54
Hoi, ik maak via ftp een nieuw bestand en cmod dit bestand 777.
Nu kan ik met fopen() content in dit bestand schrijven.

Nu wil ik php dat bestand voor mij laten maken.

Hoe ik dit moet doen ben ik nog niet helemaal achter.
ik probeer met tempnam() en tmpfile(), maar het lukt niet.

Heeft iemand dit al eens gedaan?
En wil je dit met mij (en de anderen natuurlijk:)) delen?

Alvast bedankt,
Fred
 
Ik schrijf meestal files met file_put_contents() maar die gaat er vanuit dat je schrijfrechten hebt en weet wat je er in wilt zetten...
 
Als je een bestand "fopent" voor schrijven of "appenden" wordt het bestand automatisch aangemaakt als het nog niet bestaat (en je schrijfrechten hebt in die directory):
w' Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
'w+' Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.
'a' Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.
'a+' Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.b
 
Tanks Supersnail en anderen,

ik heb mijn map schijfrechten gegeven maar deed het nog niet.
Ik heb het geprobeert in de map zelf en werkt nu wel.
Ik had als bestand:
HTML:
$bestandsnaam = "/new/fred.inc";
maar er moest dus geen slash voor.


Het werkt nu dus.:thumb:
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan