I think I’ve found a possible bug when uploading files via a template form (both channel and Freeform Pro forms). When a file is uploaded with the same name as an existing file a number is appended to the end of the file name.

This is now a particular problem on one specific site where photos are added from iPhones which always uses the filename image.jpg. There seems to be a limit to the number of duplicates as it was working fine, but now the error message “A problem was encountered while attempting to move the uploaded file to the final destination” is displayed. Looking at the file table in the database there’s now lots of versions of image.jpg with numbers appended (https://www.dropbox.com/s/rcjj55qo676qnjt/Screen%20Shot%202014-04-13%20at%2021.04.32.png), so I guess the limit of the filename length has been reached.

Has anyone else encountered this issue? Is there a workaround for it, maybe by being able to specify a filename with a timestamp or something?

  • Yes! I am encountering this exact same problem. Freeform Pro 4.2.2 EE 2.9.3 File names are getting so long that they are no longer being accepted by the system (the users are getting errors when trying to upload more images). EG File name: image111111111122222222223333333333444444444455555555556666666666777777777788888888889999999999101010101010101010101111111111111111111112121212124.jpg Files are also not displaying via {exp:freeform:entries} Has anyone solved this?
    – daver
    May 14 '15 at 23:33
  • As far as I'm aware this is still a problem. I managed to get round it by editing /system/codeigniter/system/libraries/Upload.php Around like 294 I changed code $this->file_name = $this->_prep_filename($_FILES[$field]['name']); to code $this->file_name = time() . $this->get_extension($_FILES[$field]['name']); which replaced the filename with a timestamp so it is always unique.
    – Craig
    May 16 '15 at 8:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.