forked from salsan/act
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload.php
39 lines (24 loc) · 780 Bytes
/
upload.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
include "act.php";
include "tcx.php";
if(isset($_POST['action']) and $_POST['action'] == 'upload')
{
if(isset($_FILES['user_file']))
{
$file = $_FILES['user_file'];
$url = $_FILES["user_file"]["tmp_name"];
$file_act_name = $_FILES["user_file"]["name"];
}
}
$act=simplexml_load_file($url);
$XmlAct = new act2tcx($act);
$XmlTcx = new tcx ( $XmlAct );
$PrintTcx = $XmlTcx->GetTcx();
$dom = dom_import_simplexml($PrintTcx)->ownerDocument;
$dom->formatOutput = true;
$file_act_name = preg_replace ("/.act/", ".tcx", $_FILES["user_file"]["name"] );
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.$file_act_name );
echo $dom->saveXML();
?>