<?php

/* This file handles the function of updating a file related to a certain learning object. */
require_once 'repository_fns.php';
session_start();
$old_location = $_GET['location'];
$objid = get_objid_from_location($old_location);
do_html_header_login();
if ($_FILES['userfile']['error'] > 0) {
    echo 'Problem: ';
    switch ($_FILES['userfile']['error']) {
        case 1:
            echo 'File exceeded upload_max_filesize';
            break;
        case 2:
            echo 'File exceeded max_file_size';
            break;
        case 3:
            echo 'File only partially uploaded';
            break;
        case 4:
            echo 'No file uploaded';
            break;
        case 6:
            echo 'Cannot upload file: No temp directory specified';
            break;
        case 7:
            echo 'Upload failed: Cannot write to disk';
            break;
    }
    exit;
Пример #2
0
function get_file_content_search_result($filename)
{
    if (!$filename || $filename == '') {
        return false;
    }
    $conn = db_connect();
    $objid = get_objid_from_location($filename);
    $query = "select * from object where objid='" . $objid . "'";
    $result = @$conn->query($query);
    if (!$result) {
        return false;
    }
    $num_objects = @$result->num_rows;
    if ($num_objects == 0) {
        return false;
    }
    $result = db_result_to_array($result);
    return $result;
}