When uploading files, the date created and date last modified is not taken from the file system. Instead, it is generated by Sharepoint.
You can build your own API to upload a file to Sharepoint and update the fields programmatically.
SPFieldUserValue author = new SPFieldUserValue(web, spUser.ID, spUser.LoginName);
listItem[SPBuiltInFieldId.Created] = dtCreated;
listItem[SPBuiltInFieldId.Modified] = dtModified;
listItem[SPBuiltInFieldId.Author] = author;
listItem[SPBuiltInFieldId.Editor] = author;
listItem.Update();