View PlGroup Dateihandling
ID | 29 |
Text | Dateihandling |
Title | Not set |
PlItems
- string filename = Path.GetFileName(fileNameWithPath);
- // Orginal von: http://www.sebastianviereck.de/php-nicht-schreibbare-dateien-finden-und-beheben/
function checkFileWritable($file)
{
if(!file_exists($file))
{
file_put_contents($file, "");
}
if(!chmod($file, 0644))
{
$fileowner = fileowner($file);
echo "counld not change File Permissions: $file, File Owner is: $fileowner";
if(!chown($file, ftpUserID))
{
echo "counld not change File owner: $file ";
mail(mailadresse, "Schreibeprobleme","File: $file, File Owner is: $fileowner");
}
}
}
- # Modes
# r: Read mode which is used when the file is only being read
# w: Write mode which is used to edit and write new information to the file (any existing files with the same name will be erased when this mode is activated)
# a: Appending mode, which is used to add new data to the end of the file; that is new information is automatically amended to the end
# r+: Special read and write mode, which is used to handle both actions when working with a file
myFile = open("myFile.txt","w")
myFile.write("Hello World")
myFile.close()