";
echo "ime: ".$name."
";
echo "tmpName: ".$tmpName."
";
echo "greska: ".$error."
";
echo "velicina: ".$size."
";
echo "nastavak: ".$ext."
";
switch ($error) {
case UPLOAD_ERR_OK:
$valid = true;
//validate file extensions
if ( !in_array($ext, array('csv')) ) {
$valid = false;
$response = 'Nedozvoljen tip datoteke.';
echo $response;
exit;
}
//validate file size
if ( $size/1024/1024 > 2 ) {
$valid = false;
$response = 'Velicina datoteke premasuje dozvoljenu velicinu.';
}
//upload file
if ($valid) {
// $targetPath = dirname( __FILE__ ) . DIRECTORY_SEPARATOR. 'uploads' . DIRECTORY_SEPARATOR. $name;
// move_uploaded_file($tmpName,$targetPath);
// header( 'Location: index.php' ) ;
// exit;
$response = 'Datoteka ispravna.';
}
break;
case UPLOAD_ERR_INI_SIZE:
$response = 'The uploaded file exceeds the upload_max_filesize directive in php.ini.';
break;
case UPLOAD_ERR_PARTIAL:
$response = 'The uploaded file was only partially uploaded.';
break;
case UPLOAD_ERR_NO_FILE:
$response = 'No file was uploaded.';
break;
case UPLOAD_ERR_NO_TMP_DIR:
$response = 'Missing a temporary folder. Introduced in PHP 4.3.10 and PHP 5.0.3.';
break;
case UPLOAD_ERR_CANT_WRITE:
$response = 'Failed to write file to disk. Introduced in PHP 5.1.0.';
break;
default:
$response = 'Unknown error';
break;
}
echo $response;
}
//
,ž,š slova
$row = 1;
if (fopen($_FILES['uploadFile']['tmp_name'], "r")) {
$handle=fopen($_FILES['uploadFile']['tmp_name'], "r");
//pokazi vrstu utf-a
$encoding = mb_detect_encoding($tmpName , 'UTF-8, UTF-7, ASCII, EUC-JP,SJIS, eucJP-win, SJIS-win, JIS, ISO-2022-JP');
echo "
"."Vrsta utf-a:".$encoding;
$output = '
%s | ', $value ); } $output .= '