How to set default form values based on query string, if the form uses AJAX file upload
I forgot to post the answer.

To keep the data persistent between AJAX calls, you should store it in the $form_state variable. This is how it worked in my case:


Check if I already have the data in $form_state.
If not and if there is query string, get the data, sanitize/validate it and store in $form_state.


This way it works even for AJAX calls where query string parameters are not available.