Triggered before a file is added to a product on the
Product Details page.
Inside the event handler you can validate the uploaded file and trigger an exception if it is needed.
Please read
this article to learn about
implementing the file upload support on the product details page.
Example:
public function subscribeEvents()
{
Backend::$events->addEvent('shop:onAfterProductFileAdded', $this, 'before_file_added');
}
public function before_file_added($product, $new_file)
{
if ($product->list_uploaded_files()->count >= 3)
throw new Phpr_ApplicationException('You cannot add more then 3 files');
}