before upload to server