php - File rename no longer working -


i have update controller function in laravel resource controller thats pretty basic. updates title, body etc. in db normal (no issues data updates).

the issue images. image directory each project follows slug naming convention based on title of project. built update function directory , images renamed if title changed. working fine built it, it's stopped. directory renames, files not. here relevant snippet controller:

    $count = 0;     $slug = input::get('title');     $prefix = str::slug($slug);     $oldprefix = $project->imagesprefix;     $path = public_path().'/img/projects/';     $directory = $path . $prefix;      rename($path.$oldprefix, $directory);      //dumped directory here , it's set     $files = preg_grep('~\.(jpg)$~', scandir($directory));      //dumped $files here , array set     foreach($files $file){         rename($directory.'/'.$file, $directory.'/'.$prefix.'-'.$count.'.jpg');         ++$count;     }     rename($directory.'/thumbnails/'.$oldprefix.'-thumb.jpg', $directory.'/thumbnails/'.prefix.'-thumb.jpg'); 

all of working fine when tested afternoon. updates db, renames directory folder fails rename files. i've dumped both $files , $directory before loop , both set.

if file rename fails quite related permissions.


Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -