还有怎么把图像转为二进制数据,储存在MYSQL数据库上了?
解决方案 »
- 关于php dom能不能不用DOMDocument->load 直接读取写在当前php的xml
- 从数据库中读出的$x, $y, $z为什么不能生成图形呢
- 匹配中括号中的内容的正则
- 求一个字符串函数
- php对ajax post过来的数据的处理
- 在PHP中和在MYSQL中字符的第一个字节怎么取得啊?
- 这样的mysql的limit语句如何转换
- php 分页
- 如何在PHP中设置session永久有效,除非关闭浏览器
- php.ini配置session.gc_maxlifetime无效,session依旧能访问
- 一位网友送的空间和域名,开了一个论坛,速度飞快。特此感谢。也为里面的PHP版做个广告。
- 不希望url上出现php?field=11之类的,有办法没?
mediumtext
// 在 4.1.0 以前的 PHP 中,需要用 $HTTP_POST_FILES 代替 $_FILES。
// 在 4.0.3 以前的 PHP 中,需要用 copy() 和 is_uploaded_file() 来代替 move_uploaded_file()。$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir. $_FILES['userfile']['name'];
print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploaddir . $_FILES['userfile']['name'])) {
print "File is valid, and was successfully uploaded. Here's some more debugging info:\n";
print_r($_FILES);
} else {
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
print "</pre>";
?>bool move_uploaded_file ( string filename, string destination)本函数检查并确保由 filename 指定的文件是合法的上传文件(即通过 PHP 的 HTTP POST 上传机制所上传的)。如果文件合法,则将其移动为由 destination 指定的文件。
20040512 可以自己生成! 例如 "..tmp/".time().".jpg"
$handle = fopen("image.jpg", "rb");
$contents = fread ($handle, filesize ($filename));
fclose ($handle);
?>
$contents就是图片的二进制字符串 ,直接写在数据库就可以了!
header 出文件的类型!