-
Notifications
You must be signed in to change notification settings - Fork 0
/
uploadify.php
64 lines (54 loc) · 1.58 KB
/
uploadify.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
include_once('application.php');
if (!empty($_FILES))
{
$new_folder = $defaultsarray['base_path']."uploads/";
$def_access = $defaultsarray['default_attachment_access_level'];
if(!file_exists($new_folder)) mkdir($new_folder);
$file_ext = get_file_ext($_FILES['Filedata']['name']);
$new_filename = get_unique_filename($new_folder,$_FILES['Filedata']['name']);
$curdate=0;
if (move_uploaded_file($_FILES['Filedata']['tmp_name'], $new_folder.$new_filename)) {
$curdate=mrr_pull_image_created_date($new_folder.$new_filename);
$rslt = 1;
} else {
$rslt = 0;
}
$user_id=0;
$store_id=0;
$merchant_id=0;
if(isset($_SESSION['user_id'])) $user_id=$_SESSION['user_id'];
if(isset($_SESSION['store_id'])) $store_id=$_SESSION['store_id'];
if(isset($_SESSION['merchant_id'])) $merchant_id=$_SESSION['merchant_id'];
//log that file was uploaded...
$sql = "
insert into attached_files
(linedate_added,
linedate_created,
filename,
filesize,
section_id,
xref_id,
deleted,
access_level,
uuid,
merchant_id,
store_id,
user_id)
values (now(),
'".sql_friendly($curdate)."',
'".sql_friendly($new_filename)."',
'".sql_friendly($_FILES['Filedata']['size'])."',
'".sql_friendly($_POST['section_id'])."',
'".sql_friendly($_POST['xref_id'])."',
0,
'".sql_friendly($def_access)."',
'".createuuid()."',
'".sql_friendly($merchant_id)."',
'".sql_friendly($store_id)."',
'".sql_friendly($user_id)."')
";
simple_query($sql);
//$iid=mysql_insert_id();
}
?>1