File Upload File Name Discrepancy between url_title() and upload.php's _prep_filename()

edited October 2012 in Modules
I have created a simple module and added a field ("image_upload") to the model's form_field method. Upon upload and save I noticed that the file name which is stored in the database and the filename written to the server are different (example filenames below).

It appears that my file name gets into the following conditional (codeigniter/libraries/Upload.php #988), adding underscores to the filename: if ( ! in_array(strtolower($part), $this->allowed_types) OR $this->mimes_types(strtolower($part)) === FALSE)

Then later when the image is referenced from the database I get a 404 since the paths do not match.

Example file name: "Screen Shot 2012-10-12 at 2.29.15 PM.png"
Output DB filename: screen_shot_2012-10-12_at_2.29.15_pm.png
Output file system filename: screen_shot_2012-10-12_at_2.29_.15_pm_.png

Example of $parts from line #982 Array ( [0] => Screen Shot 2012-10-12 at 2 [1] => 29 [2] => 15 PM [3] => png )

Perhaps I am not taking part in a Fuel/CI best practice and should renamed the files? However, I like that the files names are so the CMS user can select an asset from the asset manager in a human readable fashion.

Any help or tips are appreciated, thanks.

Comments

Sign In or Register to comment.