Fix file index incrementation for uploading operation