title: delete file using MySQL procedure
body: <p>Is there any way to delete file using SQL command ?<br>
  I have image files in filesystem, and links to them in DB. For example:</p>
  
  <pre><code>CREATE TABLE products (
      id INT UNSIGNED NOT NULL AUTO_INCREMENT,
      name TINYTEXT NOT NULL,
      category INT UNSIGNED NOT NULL,
      FOREIGN KEY (category) REFERENCES categories(id) ON DELETE CASCADE,
      ............
  ) ENGINE=InnoDB;
  CREATE TABLE images (
      id INT UNSIGNED NOT NULL AUTO_INCREMENT,
      img_link TINYTEXT, /*path and name of JPG/PNG file*/
      product INT UNSIGNED NOT NULL,
      FOREIGN KEY (product) REFERENCES products(id) ON DELETE CASCADE,
      ............
  ) ENGINE=InnoDB;  
  </code></pre>
  
  <p>When category\product deleted, deletes the links of images that belong to the deleted category\product. (becouse 'ON DELETE CASCADE')<br>
  But I need to delete the files itself too. Something like:  </p>
  
  <pre><code>CREATE TRIGGER del BEFORE DELETE ON images FOR EACH ROW CALL delete_file(OLD.img_link);
  </code></pre>
  
  <p>Of course its possible to create table of all files that must be deleted. I ask if is there any way to do it at real-time.<br>
  Thanks</p>