语法:string tempnam ( string dir, string prefix )
tempnam是在指定的目录下建立以prefix为前缀的唯一的临时文件(TMP(*).tmp),文件名的后缀名为tmp,这边传递的前缀(prefix),长度最大为3,如果超过了3,后面的将被截断。比如,你写TEMP,只取TEM作为前缀。
另外,getcwd函数是取得当前工作目录(get current work dir)。
// current directory echo getcwd() . " "//echo /home/didou chdir('cvs')// current directory echo getcwd() . " "//echo /home/didou/cvs
PHP里面有个move_uploaded_file()函数的,应该可以解决你这个问题。我给你贴个例子你看看:$uploaddir = '/var/www/uploads/'
$uploadfile = $uploaddir . basename($_FILES['userfile']['name'])
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n"
} else {
echo "Possible file upload attack!\n"
}
echo 'Here is some more debugging info:'
print_r($_FILES)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)