forked from micro-manager/micro-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupload_file.php
executable file
·37 lines (33 loc) · 910 Bytes
/
upload_file.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
<?php
//print_r($_FILES);
date_default_timezone_set('America/Los_Angeles');
$month = date('Ym');
$uploadPlace_ = '/home/MM/configUploads/' . $month;
if (!file_exists($uploadPlace_))
{
mkdir($uploadPlace_, 0750);
}
if ($_FILES['file']['error'] > 0)
{
echo 'Return Code: ' . $_FILES['file']['error'] . '<br />';
}
else
{
echo 'Upload: ' . $_FILES['file']['name'] . '<br />';
echo 'Type: ' . $_FILES['file']['type'] . '<br />';
echo 'Size: ' . ($_FILES['file']['size'] / 1024) . ' Kb<br />';
echo 'Temp file: ' . $_FILES['file']['tmp_name'] . '<br />';
$ipaddress = getenv(REMOTE_ADDR);
$opath = $uploadPlace_ . '/'. $_FILES['file']['name'] . '_' . $ipaddress;
if (file_exists($opath))
{
echo $_FILES['file']['name'] . ' already exists. ';
}
else
{
move_uploaded_file($_FILES['file']['tmp_name'],
$opath);
echo 'Stored in: ' . $opath;
}
}
?>