I ran across this the other day while converting a process that was using attachments to use the new Files feature. What fixed it for me was setting the FirstPublishedLocationId
to the record.
So in your example
public ID createFileFromUploadedFile(Id parentId) {
ID docID = null;
ContentVersion cv = new ContentVersion();
cv.versionData = file.Body;
cv.title = file.FileName;
cv.pathOnClient = file.FileName;
** cv.FirstPublishedLocationIdFirstPublishLocationId = parentId **
insert cv;