XSRF check failed

When trying to add an attachment to a created issue it is not allowed because of the XSRF protection. We are trying to do so with a POST request using php code form with the enctype=“multipart/form-data” attribute. Also in the HTTP headers we are setiing :"User-Agent: " . $_SERVER[‘HTTP_USER_AGENT’], "Origin: " . $_SERVER[‘HTTP_REFERER’], “Accept: application/json”, “X-Atlassian-Token: no-check”, “Content-Type: multipart/fotm-data” The problem still persist and it is not possible to add the attachment to any issue. However it works perfectly when doing it from the command line, but for the business requirements we need to implement this functionality from the server side.

Please advice! Thanks a lot