Jump to content

GROCERYCRUD - rename file when uploading

grocery-crudupload callback callback_before_upload callback_after_upload

  • Please log in to reply
1 reply to this topic

#1 manushimn



  • Members
  • Pip
  • 9 posts

Posted 15 June 2014 - 01:53 PM

I want to change the file name when uploading. I tried to do this by callbacks. But didn't work any of them.

Method 1 - using callback_before_upload

function callback1($files_to_upload,$field_info)
    foreach($files_to_upload as $value) {



Method 2 - using callback_after_upload

function callback2($uploader_response,$field_info, $files_to_upload)
     foreach($files_to_upload as $value) {
     return true;


Method1 ddnt work at all. In method2, file name at database changed to pp.pdf, but uploaded file in upload directory ddnt change at all. So my question is how to rename the file when uploading. Can anyone please help me?


#2 Amit Shah

Amit Shah

    grocery CRUD Master

  • Advanced Member
  • PipPipPip
  • 1,192 posts
  • LocationMumbai, India

Posted 16 June 2014 - 05:26 AM

well.. u have to change the name of the file that u uploaded .. it wont automatically set the name.. So you just need to add the code to change the name of the file uploaded and thats it - u done with it..


Happy GCing:)

Also tagged with one or more of these keywords: grocery-crudupload, callback, callback_before_upload, callback_after_upload

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users