Customized data are stored in customized_data table.
Uploaded file are data with "type" = 0 (Constant value is Product::CUSTOMIZE_FILE )
So you can find the customization associated with the id_cart and id_product
SELECT cd.value AS file FROM ps_customization AS c INNER JOIN ps_customized_data AS cd ON (cd.id_customization = c.id_customization) WHERE cd.type = 0 AND c.id_product = 19 AND c.id_cart = 6
Should return something like "b4b22ae6de73dafc74fae848b22e4715", that's the filename
If you have multiple customization fields of type upload you have to target on it specifically to retrieve one value. So add ps_customization_field in the query to be sure to retrieve the value for the right field. Customization Field associated can be find with "index" of ps_customized_data value (Yes that's weird)