// Setup Drag and Drop fields $aDropFields = array(); $aDropFieldTypes = array(); array_push($aDropFields, 'image_file_drop'); array_push($aDropFieldTypes, 'image'); // if form was submitted: if ($_POST['commit'] == "Cancel") { header("Location:ibeaconimage_list.php?cat=" . $_REQUEST['cat'] . "&ibeacon=" . $_REQUEST['ibeacon']); exit; } if ($_POST['commit'] == "Save iBeacon Image") { if ($id == 0) { // insert $obj = new IbeaconImage(); $obj->IbeaconId = $_REQUEST["ibeacon"]; $obj->create(); $obj->handleFileUploads(); $obj->handleDropFileUploads($aDropFields[0], 'ImageFile'); // redirect to listing list header("Location:ibeaconimage_list.php?cat=" . $_REQUEST['cat'] . "&ibeacon=" . $_REQUEST['ibeacon']); exit; } else { // update $obj = new IbeaconImage($id); $obj->update(); $obj->handleFileUploads(); $obj->handleDropFileUploads($aDropFields[0], 'ImageFile'); // redirect to listing list header("Location:ibeaconimage_list.php?cat=" . $_REQUEST['cat'] . "&ibeacon=" . $_REQUEST['ibeacon']); exit; }