optimize the upload machnism