Forums » Development »
how to attactment jpg file on redmine server
Added by Bunsong Sum over 11 years ago
Hi all please help your idea to upload jpg using php code to redmine server
This code can add issue only, can you guide me about how to upload image to server path
i have some code below:
//$result=$client->api('issue')->all();
//$issues=$result['issues'];
if(isset($_POST['task']))
{
$data=$_POST;
/*echo '';
echo $data['projectId'];
echo $data['subject'];
echo $data['description'];
echo '
';
*/
$issue = new Issue (
array(
'project_id'=>$data['projectId'],
'subject'=>$data['subject'],
'description'=>$data['description']
)
);
$issue->save();
//echo $issue->id;
}
?>
<form action="" method="post">
<input type="hidden" name="task" value="1" />
<table>
<tr>
<td>Project ID:</td>
<td>
<select name="projectId" class="select">
<?php
$all=$client->api('project')->all();
$projects=$all['projects'];
foreach($projects as $project)
{
?>
<option value="<?php echo $project['id']; ?>">
<?php
echo $project['id'];
}
?>
</option>
</select>
</td>
</tr>
<tr>
<td>Subject:</td>
<td><input name="subject" /></td>
</tr>
<tr>
<td>Description:</td>
<td>
<textarea name="description" rows="10" cols="10">
</textarea>
</td>
</tr>
<tr>
<td><input type=submit value="Create New Issue" class="button"/></td>
</tr>
</table>
</form>
$result=$client->api('issue')->all();
$issue_list=$result['issues'];
?>
Thanks
Bunsong