If you are uploading a File to SharePoint 2010 programmatically and wanted to get the ID of that newly created file then you can use following code.
//Upload your File
SPFile myFile = spList.RootFolder.Files.Add (FileUpload1.PostedFile.FileName, StreamImage, replaceExistingFiles); SPListItem item = imgFile.Item; // Then you can use item.ID
I am not providing full code for file upload but the key here is to get SPListItem from SPFile class.
I hope it helps.