Page 1 of 1

TEST - Tipo UF

Posted: Thu Mar 09, 2017 9:39 am
by tonymask
Salve,
ho provato a inserire in un TEST una domanda di Tipo UF (caricamento file) ma al momento di fare il test viene fuori l'errore:

Error on move_uploaded_file from: /tmp/php6A6oSQ to /appLms/field/NOMEDELMIOFILE

cosa può essere ? :?:

Re: TEST - Tipo UF

Posted: Thu Mar 09, 2017 9:58 am
by jasmines
Mi incolli l'intera function storeAnswer che si trova in /appLms/modules/question/class.upload.php?
E dammi anche il risultato di questa query sul db: SELECT * FROM vittoria_edotta_db.core_setting where param_name like "path%"

Re: TEST - Tipo UF

Posted: Thu Mar 09, 2017 10:11 am
by tonymask
Ecco la query

FUNZIONE

Posted: Thu Mar 09, 2017 10:15 am
by tonymask
function storeAnswer( $id_track, &$source, $can_overwrite = false ) {


require_once(_base_.'/lib/lib.upload.php');

if($this->userDoAnswer($id_track)) {
if($can_overwrite) {

return $this->updateAnswer($id_track, $source);
}
else return false;
}

$savefile = '';
//save file--------------------------------------------------------
if(isset($_FILES['quest']['name'][$this->id]) && ($_FILES['quest']['name'][$this->id] != '')) {

$path = '/appLms/'.Get::sett('pathtest');

$savefile = $_SESSION['idCourse'].'_'.$this->id.'_'.mt_rand(0, 100).time().'_'.$_FILES['quest']['name'][$this->id];
if(!file_exists($GLOBALS['where_files_relative'].$path.$savefile )) {

sl_open_fileoperations();
if(!sl_upload($_FILES['quest']['tmp_name'][$this->id], $path.$savefile)) {

$savefile = Lang::t('_QUEST_ERR_IN_UPLOAD');
}
sl_close_fileoperations();
} else {
$savefile = Lang::t('_QUEST_ERR_IN_UPLOAD');
}
}
//answer checked by the user
$track_query = "
INSERT INTO ".$GLOBALS['prefix_lms']."_testtrack_answer ( idTrack, idQuest, idAnswer, score_assigned, more_info, user_answer )
VALUES (
'".(int)$id_track."',
'".(int)$this->id."',
'0',
'0',
'".addslashes($savefile)."',
1 )";
return sql_query($track_query);

}

Re: TEST - Tipo UF

Posted: Thu Mar 09, 2017 11:59 am
by jasmines
esegui questa query:
update core_setting set param_value = "test/" where param_name = "pathtest";
e dimmi se funziona
Controlla che la cartella /files/ (e sottocartelle) sia scrivibile

Re: TEST - Tipo UF

Posted: Thu Mar 09, 2017 12:36 pm
by tonymask
GRAZIE, SEI UN GRANDE !