fix
This commit is contained in:
@@ -40,6 +40,7 @@ class Member extends Member_Controller {
|
||||
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
|
||||
|
||||
$page_key = $this->input->get('pgname');
|
||||
$data["page_key"] = $page_key;
|
||||
$member_id = $_SESSION["member_id"];
|
||||
if ($member_id > 0 && $page_key != '') {
|
||||
//echo 'yes';
|
||||
@@ -79,6 +80,7 @@ class Member extends Member_Controller {
|
||||
$action_name = $this->input->get('action_name');
|
||||
$member_id = $_SESSION["member_id"];
|
||||
$data["page_id"] = $this->input->get('page_id');
|
||||
$data["page_key"] = $this->input->get('page_key');
|
||||
|
||||
/* if ($member_id > 0 && $page_key != '') {
|
||||
//echo 'yes';
|
||||
@@ -221,8 +223,26 @@ class Member extends Member_Controller {
|
||||
}
|
||||
|
||||
public function upload() {
|
||||
|
||||
$page_item_id = 0;
|
||||
$data = [];
|
||||
$page_key = "";
|
||||
if (isset($_POST['uploadBtn']) && $_POST['uploadBtn'] == 'Upload') {
|
||||
|
||||
$page_key = $data['page_key'] = trim($this->input->post('page_key'));
|
||||
|
||||
$data['title'] = "This s the ttitle" . rand(100, 9999);
|
||||
$data['detail'] = "This s the ttitle, This s the ttitle" . rand(100, 9999);
|
||||
$data['member_id'] = $_SESSION["member_id"];
|
||||
$data['session'] = $_SESSION["sessionid"];
|
||||
$data['sessionid'] = $_SESSION["sessionid"];
|
||||
$data['item_type'] = 'VIDEOCARD';
|
||||
$data['page_id'] = trim($this->input->post('page_id'));
|
||||
if ($data['detail'] != '' && $data['title'] != '') {
|
||||
$out = [];
|
||||
$this->coregrade_webapi(COREGRADE_ACCOUNT_ADDPAGECARD, $data, $out);
|
||||
$page_item_id = $out["page_item_id"];
|
||||
}
|
||||
// print_r($data);
|
||||
if (isset($_FILES['uploadedFile']) && $_FILES['uploadedFile']['error'] === UPLOAD_ERR_OK) {
|
||||
|
||||
// get details of the uploaded file
|
||||
@@ -234,23 +254,54 @@ class Member extends Member_Controller {
|
||||
$fileExtension = strtolower(end($fileNameCmps));
|
||||
|
||||
$newFileName = md5(time() . $fileName) . '.' . $fileExtension;
|
||||
$allowedfileExtensions = array('jpg', 'gif', 'png', 'zip', 'txt', 'xls', 'doc', 'mp4');
|
||||
$allowedfileExtensions = array('jpg', 'gif', 'png', 'mp4');
|
||||
if (in_array($fileExtension, $allowedfileExtensions)) {
|
||||
|
||||
// directory in which the uploaded file will be moved
|
||||
$uploadFileDir = '/home/uploads/';
|
||||
$dest_path = $uploadFileDir . $newFileName;
|
||||
$uploadFileDir = '/home/uploads/' . $_SESSION['myfolder']; // str_pad($_SESSION["member_id"], 10, "0", STR_PAD_LEFT);
|
||||
|
||||
if (!is_dir($uploadFileDir)) {
|
||||
mkdir($uploadFileDir, 0777);
|
||||
}
|
||||
|
||||
$uploadFileDir = '/home/uploads/' . $_SESSION['myfolder'] . "/page";
|
||||
if (!is_dir($uploadFileDir)) {
|
||||
mkdir($uploadFileDir, 0777);
|
||||
}
|
||||
|
||||
|
||||
$mypath = "testdir/subdir/test";
|
||||
mkdir($mypath, 0777, TRUE);
|
||||
|
||||
|
||||
|
||||
$dest_path = $uploadFileDir . "/" . $newFileName;
|
||||
|
||||
if (move_uploaded_file($fileTmpPath, $dest_path)) {
|
||||
$message = 'File is successfully uploaded.';
|
||||
$x = [];
|
||||
$x["filename"] = $fileName;
|
||||
$x["filesize"] = $fileSize;
|
||||
$x["filetype"] = $fileType;
|
||||
$x["ext"] = $fileExtension;
|
||||
$x["page_item_id"] = $page_item_id;
|
||||
$x["page_id"] = $data['page_id'];
|
||||
$x['member_id'] = $_SESSION["member_id"];
|
||||
$x['session'] = $_SESSION["sessionid"];
|
||||
$x['sessionid'] = $_SESSION["sessionid"];
|
||||
|
||||
|
||||
} else {
|
||||
$message = 'There was some error moving the file to upload directory. Please make sure the upload directory is writable by web server.';
|
||||
}
|
||||
}
|
||||
print_r($_FILES);
|
||||
echo $message;
|
||||
// print_r($_FILES);
|
||||
// echo $message;
|
||||
// echo base_url("images/icons/edit.png");
|
||||
}
|
||||
}
|
||||
|
||||
redirect("/member/page?pgname=$page_key", 'refresh');
|
||||
}
|
||||
|
||||
public function mycalendar() {
|
||||
|
||||
Reference in New Issue
Block a user