You can get the next possible ID if you ask the DB information_schema
SELECT
information_schema.`TABLES`.AUTO_INCREMENT
FROM
information_schema.`TABLES`
WHERE
information_schema.`TABLES`.TABLE_NAME = '{Your_Table_Name}'
but this is sensible in multiuser environments
or just
1. add a new (empty) record
2. upload the file and use the given back ID from the session varible
3. update the record