Image Upload and Options

QuestionsImage Upload and Options
Paul M asked 6 years ago

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
Abu Ghufran answered 6 years ago

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

1 + 5 =

Login with your Social Id:

OR, enter

Attach code here and paste link in question.
Attach screenshot here and paste link in question.



How useful was this discussion?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate it.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?