求救 ;;;求一个php上传图片的源码
求救 ;;;求一个php上传图片的源码
今天做不出来的话工作就丢了
各位大侠帮帮忙
<form action="newsarticle.action.php?action=addnews&typeid=<?php $typeid ?>" method="post" name="addnewsform">
<table width="769" border="0">
<tr>
<td width="142"><div align="right">标题:</div></td>
<td height="72" colspan="2">
<input id="newtitle" type="text" name="newtitle" /> </td>
</tr>
<tr>
<td width="142"><div align="right">标题:</div></td>
<td height="72" colspan="2">
<input id="newtitle" type="text" name="newtitle" /> </td>
</tr>
<tr>
<td><div align="right">图片:</div></td>
<td height="58" colspan="2"><input name="newpic" id="newpic" type="file" /></td>
</tr>
<tr>
<td><div align="right">内容:</div></td>
<td height="156" colspan="2"> <?php
$oFCKeditor = new FCKeditor ( 'newcontent' );
$oFCKeditor->BasePath = "../include/fckeditor/";
$oFCKeditor->ToolbarSet = 'MyToolbar';
$oFCKeditor->Value = $article ['newcontent'];
$oFCKeditor->Height = 350;
$oFCKeditor->Create ();
?> </td>
</tr>
<tr>
<td align="right"> </td>
<td width="68" height="39" align="right"><input type="submit" name="addnewsform" value="提交" /> </td>
<td width="545"><input type="reset" name="Submit2" value="重置" /></td>
</tr>
</table>
</form>
把图片上传到存到一个文件夹里,然后在前台可以提取那个文件夹里的图片并且显示。
求救 ;;;求一个php上传图片的源码
今天做不出来的话工作就丢了
各位大侠帮帮忙
<form action="newsarticle.action.php?action=addnews&typeid=<?php $typeid ?>" method="post" name="addnewsform">
<table width="769" border="0">
<tr>
<td width="142"><div align="right">标题:</div></td>
<td height="72" colspan="2">
<input id="newtitle" type="text" name="newtitle" /> </td>
</tr>
<tr>
<td width="142"><div align="right">标题:</div></td>
<td height="72" colspan="2">
<input id="newtitle" type="text" name="newtitle" /> </td>
</tr>
<tr>
<td><div align="right">图片:</div></td>
<td height="58" colspan="2"><input name="newpic" id="newpic" type="file" /></td>
</tr>
<tr>
<td><div align="right">内容:</div></td>
<td height="156" colspan="2"> <?php
$oFCKeditor = new FCKeditor ( 'newcontent' );
$oFCKeditor->BasePath = "../include/fckeditor/";
$oFCKeditor->ToolbarSet = 'MyToolbar';
$oFCKeditor->Value = $article ['newcontent'];
$oFCKeditor->Height = 350;
$oFCKeditor->Create ();
?> </td>
</tr>
<tr>
<td align="right"> </td>
<td width="68" height="39" align="right"><input type="submit" name="addnewsform" value="提交" /> </td>
<td width="545"><input type="reset" name="Submit2" value="重置" /></td>
</tr>
</table>
</form>
把图片上传到存到一个文件夹里,然后在前台可以提取那个文件夹里的图片并且显示。
<form method="post" enctype="multipart/form-data">
选择文件:<input type='file' name='file'>
<input type='submit' name='submit' value='提交'>
</form><pre>
<?php
if(isset($_POST['submit'])){
$filename = str_replace('\\', '/', __FILE__);
$new_filename = str_replace(strrchr($filename, '/'), '/', $filename); $f=$_FILES['file'];
$type=strrchr($f['name'],".");
$t=date("YmdHis",time()+8*60*60).rand(10000,99999); while(file_exists("d:/a/".$t.$type))
$t=date("YmdHis",time()+8*60*60).rand(10000,99999); if(!is_dir('fileupload'))
mkdir('fileupload',0777); move_uploaded_file($f['tmp_name'],$new_filename.'fileupload/'.$t.$type);
}
?>
</pre>
$newfile = 'd:/test.gif'; $isok = copy($oldfile, $newfile);
if($isok)die('文件上传成功');
else die('文件上传失败');
这样也可以
用这个吧。
这是什么意思啊
这是什么意思啊
没找到emptyempty()这个函数 你看看是否引用了?!