How i can delete user private files, and where in db save links for uploaded userfiles

Re: How i can delete user private files, and where in db save links for uploaded userfiles

by Андрей Горюшкин -
Number of replies: 0

if some interested of this ->


<?php


/**

 * @author InQaaaa

 * @copyright 2016

 */

 

require("config.php");


$userid = $_GET['userid'];

$filename = $_GET['filename'];


//Get id of file

$table = "files";

$select = "filename = '$filename' AND userid = '$userid' AND filearea='private'";

$result = $DB->get_records_select($table, $select);


//Some manipultaion with stdObject

$array = json_decode(json_encode($result), True);

$array1 = array_shift($array);

$idd = $array1["id"];



// Delete it if it exists

$file = $fs->get_file_by_id($idd);


if ($file) {

    $file->delete();

}




?>