# URLConnection form data

**URL:** <https://forum.xojo.com/t/urlconnection-form-data/54859>\
**Category:** General\
**Created:** [July 22, 2020, 4:58pm UTC](https://forum.xojo.com/t/urlconnection-form-data/54859 "2020-07-22T16:58:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Björn\_Eiríksson](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@Björn\_Eiríksson](https://forum.xojo.com/u/Bj%C3%B6rn_Eir%C3%ADksson)\
**Post date:** [July 22, 2020, 4:58pm UTC](https://forum.xojo.com/t/urlconnection-form-data/54859/1 "2020-07-22T16:58:46Z")

</div>

Has anyone successfully been able to post form-data message with URLConnection ?

x-www-urlencoded does not work for attachments, which is where form-data comes in.

I have been trying to manually make the form-data package but I am guessing Xojo is doing something when I call SetRequestContent that messes it maybe.

Format of the message in PostMan for Form data is as follows:

POST /filecontroller/api/sendfile HTTP/1.1  
Host: localhost:5000  
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary7MA4YWxkTrZu0gW

----WebKitFormBoundary7MA4YWxkTrZu0gW  
Content-Disposition: form-data; name=“Component”

PictureEffects  
----WebKitFormBoundary7MA4YWxkTrZu0gW  
Content-Disposition: form-data; name=“Path”

Xojo x64  
----WebKitFormBoundary7MA4YWxkTrZu0gW  
Content-Disposition: form-data; name=“File”; filename="/C:/Users/Björn Eiríksson/Pictures/test.png"  
Content-Type: image/png

(data)  
----WebKitFormBoundary7MA4YWxkTrZu0gW

---

<div class="post-metadata">

**Author:** ![Andrew\_Lambert](https://forum.xojo.com/user_avatar/forum.xojo.com/andrew_lambert/32/215_2.png) [@Andrew\_Lambert](https://forum.xojo.com/u/Andrew_Lambert)\
**Post date:** [July 22, 2020, 8:31pm UTC](https://forum.xojo.com/t/urlconnection-form-data/54859/2 "2020-07-22T20:31:43Z")

</div>

I wrote some code to do this a few years ago for the old HTTPSocket. Should be portable to URLConnection:

[https://www.boredomsoft.org/file-uploads-form-encodings-and-xojo.bs](https://www.boredomsoft.org/file-uploads-form-encodings-and-xojo.bs)

---

<div class="post-metadata">

**Author:** ![Björn\_Eiríksson](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@Björn\_Eiríksson](https://forum.xojo.com/u/Bj%C3%B6rn_Eir%C3%ADksson)\
**Post date:** [July 22, 2020, 9:31pm UTC](https://forum.xojo.com/t/urlconnection-form-data/54859/3 "2020-07-22T21:31:38Z")

</div>

Thanks I will take a look

---

<div class="post-metadata">

**Author:** ![Björn\_Eiríksson](https://forum.xojo.com/letter_avatar_proxy/v4/letter/b/da6949/32.png) [@Björn\_Eiríksson](https://forum.xojo.com/u/Bj%C3%B6rn_Eir%C3%ADksson)\
**Post date:** [July 22, 2020, 9:38pm UTC](https://forum.xojo.com/t/urlconnection-form-data/54859/4 "2020-07-22T21:38:37Z")

</div>

I was able to fix the code I was working on for it, it was the CRLF I only had LF, the Hex editor I was using to examine the post does not show t he CR !

Thanks !

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [April 29, 2021, 4:30pm UTC](https://forum.xojo.com/t/urlconnection-form-data/54859/5 "2021-04-29T16:30:38Z")

</div>


