Jump to content

Way to check the name of the field used for uploading documents


zyON
 Share

Recommended Posts

I'm using hooks to process documents after the upload on a page. 

I've 3 different fields that can be used for uploading documents like "photos", "pdfs", "floorplans". 

How can I know which field on the page activated the hook so I can process them differently?

Thanks.

Link to comment
Share on other sites

Ok, found it:

Using a InputfieldFile::fileAdded hook that returns a pageFile object:

public function addFile($event){
$file = $event->arguments(0); // file uploaded
$field = $file->field->name; // name of the field on the page used for uploading the file
(...)
}
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...