# TMP: php_docs_project
```
# php.ini
;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;
; Whether to allow HTTP file uploads.
; http://php.net/file-uploads
file_uploads = On
; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
upload_tmp_dir ="c:/wamp64/tmp"
; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 32M
; Maximum number of files that can be uploaded via a single request
max_file_uploads = 20
```
```php
# index.php
<?php
include('appParams.php');
$html_page = file_get_contents('C:\\wamp64\\www\\pdz_docs_draft\\data\\templates\\create_doc.html');
echo($html_page);
```
```php
# appParams.php
<?php
$uploaddir = 'C:\\wamp64\\www\\pdz_docs_draft\\data\\docs\\';
date_default_timezone_set('Europe/Moscow');
```
```php
# api.php
<?php
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
include('appParams.php');
if($_FILES){
echo '<pre>'; var_dump($_FILES); echo '</pre>';
// ============ записываем файлы в папку ======================
$tmp_main_file_name = $_FILES['f_name']['tmp_name'];
$destination_main_file_name = $uploaddir.basename($_FILES['f_name']['name']);
move_uploaded_file($tmp_main_file_name, $destination_main_file_name);
if($_FILES['f_alt_name']):
$tmp_alt_file_name = $_FILES['f_alt_name']['tmp_name'];
$destination_alt_file_name = $uploaddir.basename($_FILES['f_alt_name']['name']);
move_uploaded_file($tmp_alt_file_name, $destination_alt_file_name);
endif;
// ===========================================================
$arr = array();
$arr['fname'] = $_FILES['f_name']['name'];
$arr['created_at'] = date('Y-m-d H:m:s', time());
$arr['mime_type'] = $_FILES['f_name']['type'];
// if( $_FILES['f_name']['type'] = 'application/octet-stream'){};
$arr['alt_path'] = $_FILES['f_alt_name']? $_FILES['f_alt_name']['name'] : "";
// $arr['request_time'] = gmdate('Y-m-d H:m:s', $_SERVER['REQUEST_TIME']);
$arr['doc_type_id'] = (int)$_POST['doc_type'];
echo '<pre>'; var_dump($arr); echo '</pre>';
}
}
```
```html
# create_doc.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form enctype="multipart/form-data" action="/pdz_docs_draft/api.php" method="POST">
<div>
<label for="doc_type">DocType</label>
<select name="doc_type" id="doc_type">
<option value="1">UnoDoc</option>
<option value="2">DosDoc</option>
</select>
</div>
<div>
<!-- <input type="hidden" name="MAX_FILE_SIZE" value="8000" /> -->
<label for="f_name">Файл основного документа:</label>
<input id="f_name" name="f_name" type="file" />
</div>
<div>
<!-- <input type="hidden" name="MAX_FILE_SIZE" value="8000" /> -->
<label for="f_alt_name">Файл для просмотра документа (PDF / PNG):</label>
<input id="f_alt_name" name="f_alt_name" type="file" />
</div>
<div>
<input type="submit" value="Отправить" />
</div>
</form>
</body>
</html>
```
---
## DOC 2 PDF
- <https://pikabu.ru/story/konvertatsiya_docx_v_pdf_sredstvami_python_10478751>