Looks like copied tempfile need to be flushed before further processing. This issue won't happen if the uploaded file has enough file size.