# Attachment upload fails

**URL:** <https://forum.xwiki.org/t/attachment-upload-fails/8409>\
**Category:** Help / Discuss\
**Created:** [March 9, 2021, 7:50pm UTC](https://forum.xwiki.org/t/attachment-upload-fails/8409 "2021-03-09T19:50:34Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![polx](https://forum.xwiki.org/user_avatar/forum.xwiki.org/polx/32/200_2.png) [@polx](https://forum.xwiki.org/u/polx)\
**Post date:** [January 14, 2022, 11:22pm UTC](https://forum.xwiki.org/t/attachment-upload-fails/8409/17 "2022-01-14T23:22:51Z")

</div>

Hello all,  
I faced the same problem after upgrading from xwiki 11 to 13.10. And I also run short-URLs and would prefer not to abandon them.

Based on the detailed attempts of @heinoh I observed the network tab of the inspector for the wysiwyg editor: The xredirect and form\_token parameters are passed at the URL. This, probably, allows an upload form recipient to check the validity of the the CSRF token before starting to swallow the attachment which is, otherwise, as part of the big stream of attachments.

So I tried to correct `upload.min.js` to do the same.  
I simply replaced `upload.min.js` by `upload.js` (to make it readable) then changed the line 237 from `request.open('POST', this.formData.action);` to `request.open('POST', this.formData.action + "?form_token="+this.formData.additionalFields["form_token"] + "&xredirect=" + escape(this.formData.additionalFields["xredirect"]));`.

This made my uploads work. ShortURLs remain active :-).

I am not sure if or how I should file a fix within a jira issue.  
paul

---

_[View the full topic](https://forum.xwiki.org/t/attachment-upload-fails/8409)._
