Update File Upload Function

Add more codes on file processing logic