⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Dynamic upload path for Image CRUD??



Sebastián
  • profile picture
  • Member

Posted 28 December 2016 - 21:15 PM

Hello developers!!

I'm working with Image CRUD and it works fine with an specific upload path, but I'm trying to upload images to a dynamic folder name.

If I define the variable $path = '../images/gallery/25'; it works fine, but when I try to define it dynamicly with the $property_id parameter it doesn't work. It upload the images to another folder named "upload_file" (I didn't created it).

Any idea about it?

function test($property_id = "")
{
        $image_crud = new image_CRUD();		

        $path = '../images/gallery/'.$property_id;
	$image_crud->set_primary_key_field('image_id');
	$image_crud->set_url_field('image_url');
	$image_crud->set_table('images')
	    ->set_image_path($path);
            //->set_image_path('../images/gallery/25'); this works fine but is not dynamic

	$output = $image_crud->render();
	$this->_example_output($output);		
}