Jump to content

[SOLVED] error trying to create file in php


daveh33

Recommended Posts

The code I am using is: -

 

$title = $_POST['title'];
$random = rand(+1,1000000);
$filename = '/promotions/$title_$random.php';
$fh = fopen("$filename", "w");
if($fh==false)
die("unable to create file"); 

 

I get the error

 

Warning: fopen(/promotions/$title_$random.php): failed to open stream: No such file or directory in insertnew.php on line 13

unable to create file

 

I have set the permissions to 777 - why would I get this error? Or should I be using a different code??

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.