before the upload to server