Below you can find an example of an application by which you can submit with PHP documents through the Upload web service.
Example
<html>
<body>
<form enctype="multipart/form-data" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="1000000" />
<table>
<tr>
<td>WebserviceAccessKey</td>
<td><input style="width: 250px" id="webserviceaccesskey" name="webserviceaccesskey"></td>
</tr>
<tr>
<td>Administratie ID</td>
<td><input style="width: 250px" id="administrationid" name="administrationid"></td>
</tr>
<tr>
<td>Te verzenden bestand:</td>
<td><input name="fileupload1" type="file" />
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="verzenden" /></td>
</tr>
</table>
</form>
</body>
</html>
<?php
try {
$filename = $_FILES['fileupload1']['name'];
$filesize = $_FILES['fileupload1']['size'];
$filedata = file_get_contents($_FILES['fileupload1']['tmp_name']);
if($filesize > 0) {
$webservice_url = 'https://api.yukiworks.be/docs/Upload.aspx';
$key = $_REQUEST['webserviceaccesskey'];
$admin_id = $_REQUEST['administrationid'];
$url = $webservice_url . '?WebServiceAccessKey=' . $key . '&Administration=' . $admin_id . '&FileName=' . urlencode($filename);
$params = array('http' => array(
'method' => 'POST',
'header' => 'Content-Length: ' . $filesize,
'content' => $filedata
));
$ctx = stream_context_create($params);
$fp = fopen($url, 'rb', false, $ctx);
$response = @stream_get_contents($fp);
print_r($response);
}
}
catch(Exception $e) {
print $e;
}
?>
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article