Uploaded files via CURL are empty
-
/usr/bin/curl -v -d foo.mcf.pre.gcode -X PUT http://192.168.255.30/machine/file/gcodes/Palette/foo.mcf.pre.gcode * Trying 192.168.255.30... * TCP_NODELAY set * Connected to 192.168.255.30 (192.168.255.30) port 80 (#0) > PUT /machine/file/gcodes/Palette/foo.mcf.pre.gcode HTTP/1.1 > Host: 192.168.255.30 > User-Agent: curl/7.64.1 > Accept: */* > Content-Length: 17 > Content-Type: application/x-www-form-urlencoded > * upload completely sent off: 17 out of 17 bytes < HTTP/1.1 201 Created < Date: Thu, 28 Jan 2021 11:31:57 GMT < Server: Kestrel < Content-Length: 0 < Location: gcodes/Palette/foo.mcf.pre.gcode < * Connection #0 to host 192.168.255.30 left intact * Closing connection 0
Am I missing something?
-
@MartinNYHC Why are you using PUT? Try to use POST method.
-
When using POST i get HTTP error code 405
/usr/bin/curl -v -d foo.mcf.pre.gcode -X POST http://192.168.255.30/machine/file/gcodes/Palette/foo.mcf.pre.gcode Note: Unnecessary use of -X or --request, POST is already inferred. * Trying 192.168.255.30... * TCP_NODELAY set * Connected to 192.168.255.30 (192.168.255.30) port 80 (#0) > POST /machine/file/gcodes/Palette/foo.mcf.pre.gcode HTTP/1.1 > Host: 192.168.255.30 > User-Agent: curl/7.64.1 > Accept: */* > Content-Length: 17 > Content-Type: application/x-www-form-urlencoded > * upload completely sent off: 17 out of 17 bytes < HTTP/1.1 405 Method Not Allowed < Date: Thu, 28 Jan 2021 11:49:27 GMT < Server: Kestrel < Content-Length: 0 < Allow: DELETE, GET, PUT < * Connection #0 to host 192.168.255.30 left intact * Closing connection 0
-
-
@Veti Also tried that but then I get HTTP/1.1 404 Not Found.
* Trying 192.168.255.30... * TCP_NODELAY set * Connected to 192.168.255.30 (192.168.255.30) port 80 (#0) > POST /rr_upload?name=gcodes/foo.mcf.pre.gcode HTTP/1.1 > Host: 192.168.255.30 > User-Agent: curl/7.64.1 > Accept: */* > Content-Length: 156 > Content-Type: multipart/form-data; boundary=------------------------b7bdfc0b11202264 > * We are completely uploaded and fine < HTTP/1.1 404 Not Found < Date: Thu, 28 Jan 2021 11:53:02 GMT < Server: Kestrel < Content-Length: 0 < * Connection #0 to host 192.168.255.30 left intact * Closing connection 0
-
Any other ideas? No matter what I try, I get 404/405 or the file is there but empty.
-
never tried personally but isn't the upload URL something like
http://duet.local/rr_upload?...
-
-
Yes, but I would like to know if I'm simply to stupid or if something strange is going on
-
i just checked and upload using dwc
POST
http://192.168.1.220/rr_upload?name=0:/gcodes/duet_pa.gcode&time=2018-11-3T6:14:59&crc32=365da967 -
Very strange....404 error.
curl -v -F file=foo.mcf.pre.gcode http://192.168.255.30/rr_upload?name=0:/gcodes/duet_pa.gcode&time=2018-11-3T6:14:59&crc32=365da967 * Trying 192.168.255.30... * TCP_NODELAY set * Connected to 192.168.255.30 (192.168.255.30) port 80 (#0) > POST /rr_upload?name=0:/gcodes/duet_pa.gcode&time=2018-11-3T6:14:59&crc32=365da967 HTTP/1.1 > Host: 192.168.255.30 > User-Agent: curl/7.64.1 > Accept: */* > Content-Length: 156 > Content-Type: multipart/form-data; boundary=------------------------deaa13d4181c5fac > * We are completely uploaded and fine < HTTP/1.1 404 Not Found < Date: Thu, 28 Jan 2021 16:13:43 GMT < Server: Kestrel < Content-Length: 0 < * Connection #0 to host 192.168.255.30 left intact * Closing connection 0
-
@MartinNYHC I don't think the Content-Type is correct. The body must be the raw file content, e.g.
curl -X PUT -H "Content-Type: text/plain" --data "this is raw data" ...
@Veti The upload requests for DSF are different, so POST rr_upload will not work.
-
@chrishamm said in Uploaded files via CURL are empty:
@MartinNYHC I don't think the Content-Type is correct. The body must be the raw file content, e.g.
curl -X PUT -H "Content-Type: text/plain" --data "this is raw data" ...
@Veti The upload requests for DSF are different, so POST rr_upload will not work.
Yup, that makes sense...
curl -v -X PUT -H "Content-Type: text/plain" --data @foo.mcf.pre.gcode "http://192.168.255.30/machine/file/gcodes/foo.mcf.gcode" * Trying 192.168.255.30... * TCP_NODELAY set * Connected to 192.168.255.30 (192.168.255.30) port 80 (#0) > PUT /machine/file/gcodes/foo.mcf.gcode HTTP/1.1 > Host: 192.168.255.30 > User-Agent: curl/7.64.1 > Accept: */* > Content-Type: text/plain > Content-Length: 8368 > Expect: 100-continue > < HTTP/1.1 100 Continue * We are completely uploaded and fine < HTTP/1.1 201 Created < Date: Thu, 28 Jan 2021 16:21:19 GMT < Server: Kestrel < Content-Length: 0 < Location: gcodes/foo.mcf.gcode < * Connection #0 to host 192.168.255.30 left intact * Closing connection 0
That works.
Thanks @chrishamm !
-
@chrishamm said in Uploaded files via CURL are empty:
DSF
if you are running a pi it would be easier to just upload the file via ssh with scp.
-
This post is deleted!