源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

php上传图片到指定位置路径保存到数据库的具体实现

  • 时间:2022-12-07 06:35 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:php上传图片到指定位置路径保存到数据库的具体实现
1.conn.php
[url=upload.php]} ?> <html> <head> <title>文件上传实例</title> </head> <body> <form method="post" action="?action=save" enctype="multipart/form-data"> <table border=0 cellspacing=0 cellpadding=0 align=center width="100%"> <tr> <td width=55 height=20 align="center"> </TD> <td height="16"> <table width="48%" height="93" border="0" cellpadding="0" cellspacing="0"> <tr> <td>标题:</td> <td><input name="title" type="text" id="title"></td> </tr> <tr> <td>文件: </td> <td><label> <input name="file" type="file" value="浏览" > <input type="hidden" name="MAX_FILE_SIZE" value="2000000"> </label></td> </tr> <tr> <td> </td> <td><input type="submit" value="上 传" name="upload"></td> </tr> </table></td> </tr> </table> </form> </body> </html>
3.uploadclass.php 4.数据库文件 -- phpMyAdmin SQL Dump -- version 2.9.1.1 -- http://www.phpmyadmin.net -- -- 主机: localhost -- 生成日期: 2009 年 07 月 30 日 21:43 -- 服务器版本: 5.0.11 -- PHP 版本: 5.1.1 -- -- 数据库: `database` -- -- -------------------------------------------------------- -- -- 表的结构 `news` -- CREATE TABLE `news` ( `id` int(11) unsigned NOT NULL auto_increment, `title` varchar(50) NOT NULL, `content` varchar(50) NOT NULL, `path` text NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=gb2312 AUTO_INCREMENT=8 ; -- -- 导出表中的数据 `news` -- INSERT INTO `news` (`id`, `title`, `content`, `path`) VALUES (1, 'ag ', 'ag ', '1.html'), (2, '你好2', '你好,新闻内容2', '2.html'), (3, '', '', '3.html'), (4, 'ga ', 'ag ', '4.html'), (5, 'ag ', 'ag ', '1.html'), (6, 'ag ', 'ag ', '2.html'), (7, 'ag ', 'ag ', '3.html'); -- -------------------------------------------------------- -- -- 表的结构 `upload` -- CREATE TABLE `upload` ( `uploadid` int(11) unsigned NOT NULL auto_increment, `title` varchar(50) NOT NULL, `pic` varchar(50) NOT NULL, PRIMARY KEY (`uploadid`) ) ENGINE=InnoDB DEFAULT CHARSET=gb2312 AUTO_INCREMENT=10 ; -- -- 导出表中的数据 `upload` -- INSERT INTO `upload` (`uploadid`, `title`, `pic`) VALUES (1, 'ga ', 'upfiles/CR-xpvDk12dsI.jpg'), (2, 'ga ', 'upfiles/CR-HkC6fBfAtW.jpg'), (3, '你好', 'upfiles/CR-E8Ohxk6KxB.jpg'), (4, '', ''), (5, '', ''), (6, '', 'upfiles/CR-92xaug6jhu.jpg'), (7, '', 'upfiles/CR-a7niAZlhfW.jpg'), (8, '帅哥', 'upfiles/CR-v9Ary46JoS.jpg'), (9, '爱国', 'upfiles/CR-XyaJEndF1K.jpg');
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部