How to attach files via ASP.net application to FogBugz with C# -


i have asp.net application allows users report bugs , attach files. bug detail , attachments should saved in fogbugz. have managed create except file attachment part.

here code:

private void newcasewithfile()      {         string fburl = "https://test.fogbugz.com/api.asp";         string fbtoken = loginfogbugz();         string param = "";           param += "cmd=new";         param += "&token=" + fbtoken;           param += "&stags=" + "onlineservice,";         param += "&stitle=" + "testing";          param += "&sevent=" + "this case being created visual studio";         param += "&nfilecount=" + "1";         param += "&file1=" + "picture.png";           httpwebrequest httpwebrequest = (httpwebrequest)webrequest.create(fburl + "?" + param);         httpwebrequest.method = webrequestmethods.http.post;         httpwebrequest.contenttype = "multipart/form-data";          httpwebrequest.accept = "application/xml";         httpwebrequest.contentlength = 0;          httpwebresponse response = (httpwebresponse)httpwebrequest.getresponse();         streamreader streamreader = new streamreader(response.getresponsestream());         xdocument doc = xdocument.load(streamreader);     } 

i have tried instructions under "editing cases" did not help. in fact have no idea file 1, file 2 , how send them fogbugz.

can me this? many thanks!

file1 should specified in body of multipart/form-data post (not querystring parameter).

you have specify bytes in file.

there's answer on fogbugz.stackexchange.com c# fogbugz api wrapper handle parts you.

the form parts in body of post like

--sdfjdsjsdflk boundary-- content-disposition: form-data; name="file1"; filename="foo.jpg" content-transfer-encoding: base64 content-type: image/png  slfkajdflksjflajfdj sldfjsd;aljfds these actual data bytes foo.jpg file slfkjdsfljds sdflajsdfs 

or can @ this question points rfc example.


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -