I am trying to move file outside Codeigniter path like "/home/uploads" using move_uploaded_file or copy but both method doesn't work!
I uploaded the files by using Grocery Crud library & tried to move file using callback_after_upload.
in Grocery Crud Controller:
$crud->callback_after_upload(array($this, 'upload'));
and in the callback function:
function upload($uploader_response,$field_info, $files_to_upload){
ini_set("display_errors",1);
$baseURl = site_url();
$upload_config['upload_path'] = '';
$file_uploaded = $field_info->upload_path.'/'.$uploader_response[0]->name;
copy($file_uploaded, "/home/uploads/");
any help please!
I think you need to include the filename in the destination
copy($file_uploaded, "/home/uploads/".$uploader_response[0]->name);
move_uploaded_file()
is probably more appropriate as it won't leave a file in the upload folder like copy()
does. Again, include the file's name in the destination.