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
|
<?php
/*print_r ($_POST); print_r ($_FILES); updateAlbums_dataparser(); echo "<br></br>"; print_r ($_POST); print_r ($_FILES); exit();*/
require_once($LIBPATH . "libutil.php"); assert_rights("D"); require_once($LIBPATH . "db/libfunc.php"); require_once($LIBPATH . "thumbnail_generator.php"); $requiredVars = array("ID"); $returnC = array(574, "albums"); $updateFields = array("NameRO", "ContentRO", "ImgID", "OrderID"); UpdateRecord(array("ID"), array("POST/ID"), "ALBUMS", $requiredVars, $updateFields, $_POST, $returnC, "updateAlbums_dataparser");
function updateAlbums_dataparser() { global $BASEPATH; $target_path = $BASEPATH . "images/"; if(is_uploaded_file($_FILES['ImgID']['tmp_name'])) { $exists = false; while(!$exists) { srand((double)microtime()*1000000); $imgIndex = rand(1, 3000000); $name = $imgIndex . basename($_FILES['ImgID']['name']); $fileName = $target_path . $name ; if(!file_exists($fileName)) { $exists = true; } } if(move_uploaded_file($_FILES['ImgID']['tmp_name'], $fileName)) { $retArr['ImgID'] = $name; $thb_name=$target_path . "thb_" . $name; $namet=$target_path . $name; createThumbnail($namet,$thb_name,100,80); } else $retArr['ImgID'] = $_POST['hdImage']; } else $retArr['ImgID'] = $_POST['hdImage']; //echo $_POST['hdImage']; //echo $retArr['ImgID']; return $retArr; }
?>
|