Little problem with new file name function - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Little problem with new file name function (/showthread.php?tid=60116) |
Little problem with new file name function - El Forum - 01-19-2014 [eluser]Unknown[/eluser] Hello everybody, i've got a little problem with my code when I type "http://localhost/ci/index.php/admin/new_file_name/MB.jpg" into my browser. Of course file MB.jpg exist in upload folder. I've got VARCHAR(20) in database and i want to cut uploaded filename to max. 18 chars and ad number up to 99 to the filename when file existed. For example if myfilename.jpg exists, function will return myfilename1.jpg etc. So this is my code Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); The script echos "BBB". What is the reason of this behaviour when the file exists? When script display $uri on the screen I can access the file. Please for help, maybe I've made a little, stupid mistake ;-) Have you got any other ideas to except same file names? Little problem with new file name function - El Forum - 01-19-2014 [eluser]CroNiX[/eluser] Because of this: Code: $url = base_url($this->upload_dir . '/' . $file); Code: $uri now = http://yoursite.com/some_dir/the_file.ext It should be a filepath Code: /the/file/path/to/the_file.ext PHP Manual: file_exists() Little problem with new file name function - El Forum - 01-19-2014 [eluser]Unknown[/eluser] Thank you ;-) |