Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $dirPath = 'c:/xampp\htdocs/lookinggood\public/img\testsave';
- if (!file_exists($dirPath)) { // make directory path
- echo PHP_EOL, 'create path';
- mkdir($dirPath, 0, true);
- }
- else {
- echo PHP_EOL, 'path already exists: ', $dirPath;
- }
- $file = $dirPath .'/2015-10-07-11-40-19-edit-one.jpg';
- if (!file_exists($file)) {
- echo PHP_EOL, 'Creating file: ', $file, PHP_EOL;
- touch($file);
- }
- else {
- echo PHP_EOL, 'file already exists: ', $file, PHP_EOL;
- }
- $fileInfo = new SplFileInfo($file);
- var_dump(PHP_EOL. 'Filepath: '. $file,
- PHP_EOL. 'file found: ', file_exists($file),
- PHP_EOL. 'SplFileInfo:', $fileInfo,
- PHP_EOL. 'SplFileInfo->readable:', $fileInfo->isReadable(),
- PHP_EOL. 'SplFileInfo->writable:', $fileInfo->isWritable(),
- __FILE__.__LINE__);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement