Is this possible with image upload:
dynamic name folders , I want create path user/id from table
Resize image and rename if file already exists in folder
Thanks
1 Answers
You can achieve this using on_insert / on_update event.
For e.g.
// use events if you need custom logic for upload
$e["on_insert"] = array("add_invoice", null, true);
// var g is new jqgrid()
$g->set_events($e);
// callback for add
function add_invoice($data)
{
$upload_file_path = $data["params"]["note"];
// get file name
$f = pathinfo($upload_file_path);
// assuming userid is in session
$userid = $_SESSION["userid"];
// move file to userid folder
rename($upload_file_path,"user/$userid/".$f["basename"]);
}
Your Answer