curl - Uploading files to seafile in Unity3d C# -
i have unity3d project upload & download files. have downloading (and other relevant seafile api related calls) working should, can't seem make uploading work correctly. can make uploading part function using curl command such as
curl -h "authorization: token token-goes-here" -f file=@e:/sample.png -f filename=sample.png -f parent_dir=/ http://url.here/upload-api/1a95255d-ac0c-44d0-bfa5-dd2a46f2cc89 however, have been unable achieve same type of call using www, or unitywebrequest. here sample of code using www (i omitted authorization token on purpose here, adding has no effect on upload). constructed similar call using unitywebrequest, ran same issue, seafile returns bad request -error.
www localfile = new www("file:///" + "e:/sample.png"); wwwform requestdata = new wwwform(); requestdata.addbinarydata("file", localfile.bytes); requestdata.addfield("parent_dir", "/"); requestdata.addfield("filename", "sample.png"); www req = new www(upload_url, requestdata); yield return req; when observing packets sent unity3d , comparing them packets sent using curl, noticed small difference, can't figure out cause it. packet sent curl split 4 parts, , packet sent unity3d split 2 parts. have tried mess boundary, have tried building packet unitywebrequest proposed in unity3d forums, , have tried building packet manually , using httpwebrequest, end having same issue curl -packet , unity3d -packet have slight difference, somehow doesn't work seafile. have attached images of difference in packets sent curl , unity.
Comments
Post a Comment