if
(!
empty
(
$_FILES
)) {
echo
$_FILES
[
'Filedata'
][
'name'
];
$tmpDir
=
$_POST
[
'note'
];
$fileName
= iconv(
"UTF-8"
,
"GB2312"
,
$_FILES
[
"Filedata"
][
"name"
]);
$file
=
$_FILES
[
"Filedata"
][
"tmp_name"
];
$path
=
"uptemp/"
.
$tmpDir
.
"_org/"
;
if
(!
is_dir
(
$path
))
mkdir
(
$path
);
if
(
copy
(
$file
,
$path
.
$fileName
)){
$_ft
=
$file
;
}
else
{
$_ft
=
"no"
;
}
$fileName
=
str_replace
(
" "
,
"\ "
,
$fileName
);
$pathTmb
=
"uptemp/"
.
$tmpDir
.
"/"
;
$extPos
=
strrpos
(
$fileName
,
"."
);
$secfile
=
substr
(
$fileName
,0,
$extPos
);
$tmbName
=
$secfile
.
".jpg"
;
if
(!
is_dir
(
$pathTmb
))
mkdir
(
$pathTmb
);
if
(!
file_exists
(
$pathTmb
.
$tmbName
)){
$cmd
= IMAGEMAGICKDIR.
"/convert -resize 110x110 "
.
$path
.
$fileName
.
" "
.
$pathTmb
.
$tmbName
;
system(
$cmd
);
}
$tmbName
=
str_replace
(
"\ "
,
" "
,
$tmbName
);
readfile(
$pathTmb
.
$tmbName
);
exit
;
$fileName
= iconv(
"GB2312"
,
"UTF-8"
,
$secfile
);
}
function
getExt(
$fileName
){
$ext
=
explode
(
"."
,
$fileName
);
$ext
=
$ext
[
count
(
$ext
) - 1];
return
strtolower
(
$ext
);
}