php - Attaching file using redmine rest api -


  if ($ _FILES ["file"] ["error"]> gt; 0) {echo "error:". $ _FILES ["file"] ["error"]. "& Lt; br & gt;"; } And {$ attachement = file_get_contents ($ _ files ['file'] ['tmp_name']); $ Upload = json_decode ($ client- & gt; api ('attachment') - & gt; upload ($ accent)); $ Client- & gt; API ('issue') - & gt; (Test 'api3 (xml) 3', 'description' = & gt; test api3 ',' Assigned_to_id '=> 23, create (' project_id '= & gt; 12;' theme_id ' 'Upload' = & gt; Array (Arrays ('Token' = & gt; $ upload-> Upload-> Token, 'Filename' = & gt; $ _FILES ["File"] ["Name"] , 'Description' = & gt; 'Myfile is better then your file ...', 'content_type' = & gt; 'image / PNG'))); print_r ($ customer); }   

The problem is that file acrate is saved incorrectly in the Redmin server!

Maybe your question is out of date. But I worked on attaching a file to a Redmond issue. I do not have my old code yet, but I acknowledge that after uploading it my files were also broken.

There was a problem for me content_type . My solution was simple, I brought content_type up from the upload form. Like this:

  'content_type' = & gt; $ _FILES ['file'] ['type']   

Maybe it will help you?

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -