Jump to content

[SOLVED] File is wiped blank when opened with fopen()


elite_prodigy

Recommended Posts

I'm using the following to open a file:

 

<?php

$local = "overall.css";
$css_file = fopen($local, "w+");
$CSS = fread($css_file, 400000);
fclose($css_file);
?>

 

The following is supposed to display the output:

 

<textarea name="css" rows="35" cols="75" wrap="virtual"><?php echo $CSS; ?></textarea>

 

But, everytime I view the page that opens and reads the file, the file is empty! I don't think I'm doing anything wrong, but obviously something isn't working right.

 

Can someone please help me?

are you running the scrip in the same directory as the file "overall.css" is stored?  It could be that the script is not really find the file you think you're looking for and is showing a new, blank page.  perhaps you could try the full path to the file.

 

$local = "/var/www/mywebsite/path/to/overall.css";

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.