php - Attaching file using redmine rest api -
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 Maybe it will help you?
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); }
content_type . My solution was simple, I brought content_type up from the upload form. Like this:
'content_type' = & gt; $ _FILES ['file'] ['type']
Comments
Post a Comment