replace getLastInsertId() with id
imlement file reuploading with deleting of old version