You are not logged in.
Pages: 1
Greetings.
I was asked to develop a simple template to submit tickets from our intranet. Because GLPI includes a simple template already, I proceeded into adapting it to our needs and make use of the Rest API. Using the template from the GLPI server everything works without hicups, including uploading files.
I was then asked to make the process without the user having to submit login/password (yeah, SSO), but I had to opt for a far simpler solution because I don't have access to the AD server, which forces me to depend on someone else, and that drives me nuts.
Because ou intranet runs on IIS (v10), so I did install it on my desktop(Windows 10 1809) and copy the necessary files from the GLPI server to the root folder of IIS (with PHP 7.2). This way I can retrieve the domain\user already authenticated and submit the ticket to the GLPI server, and upload files at the same time if necessary. To summarize the process, what I do is:
Template running on a IIS instance -> connect to GLPI server by Rest API -> GLPI server
All browsers that I tested work, except for Edge. although I can submit tickets, uploading files fails.
I use 2 files, hd.php and send.php
this code it's part of the form on hd.php
<div class="file"><label for="file">File (máx 2 MB): </label>
<input type="file" name="filename<?php echo $rand ?>[]" id="file" /></div>
and on send.php I have this for the upload part
$inputname = array_keys($_FILES)[0];
$filename = $_FILES[$inputname]['name'][0];
$filepath = $_FILES[$inputname]['tmp_name'][0];
if($filename!='') {
// let's proceed a document addition
$response = $api_client->post($base_uri.'/Document', [
'headers' => [
'Session-Token' => $sess_token,
'App-Token' => $app_token
],
'multipart' => [
// the document part
[
'name' => 'uploadManifest',
'contents' => json_encode([
'input' => [
'name' => $filename,
'_filename' => [$filename],
'itemtype' => 'Ticket',
'items_id' => $ticket_id
]
])
],
// the FILE part
[
'name' => $filename,
'contents' => file_get_contents($filepath),
'filename' => $filename,
]
]]);
Most of you will find the code familiar and its because I make use of the code included on the documentation.
What I did notice is that Edge apparently don't create temporary files. I know that this is nowhere a GLPI problem, but if any of you guys may have an idea about what's going on, it will be very appreciated. Thanks.
Kind regards
Offline
Pages: 1