解决方案 »
- 请问php生成一个渐变图片怎么写?
- 批量添加的问题
- 一段php代码,想转换成c#啊,大家帮忙看看呵~
- 为什么在DREAMWEAR2004里面花上了表格,页面上却不显示?
- PHP与C语言交互!
- php高手帮帮忙!!!!!!!!!!!!!!急!!!!!!!
- PHP能否直接打开网站上的HTML文件,进行编辑后再保存覆盖原来的文件
- 我想这样,当我选中某个下拉框的一个选项时,下面的的某个输入框名称会变化.............
- 在 PHP 中,如何使用 JAVA BEANS,提供资料或者指示者有分!
- apache2.0.39+php4.2.1+win2k的设置问题
- 一个伪静态的写法问题
- 在php界面select下拉框出不来
你试试下面这个 看看打印什么信息 在贴出来看看<?
if (empty($_FILES["photo"]["photo"]) && !empty($_FILES["photo"]["tmp_name"])) { $newname = "123.jpg"; $basePath = $_SERVER["DOCUMENT_ROOT"] . "/rlx/image/"; if (file_exists($basePath)) { $path = $basePath . $newname;
$ret = move_uploaded_file($_FILES["photo"]["tmp_name"], $path); if ($ret) {
echo "Done";
}
else {
echo "Move error";
}
}
else {
echo $basePath, "not exist."; }
}
else {
echo "error.";
var_dump($_FILES);
}
?>
写错了地方
empty($_FILES["photo"]["error"])
//之后添加一句、需要创建目录的权限
if(!file_exists($path)){
mkdir($path,777,true);
}
<?php
date_default_timezone_set('prc');
include("../../dbhelper.php");
$name = $_FILES["photo"]["name"];
$size = $_FILES["photo"]["size"]/1024;
$content = $_REQUEST["content"];
$type = strstr($name,".");
$newname = date("ymd_His")."_".rand(10,99).$type;
$path = $_SERVER["DOCUMENT_ROOT"]."/rlx/image/".$newname;
if(!file_exists($path)){
mkdir($path,777,true);
}if(!preg_match("/JPG|GIF|PNG/i",$type))
header("../location:msg.php?num=9");
else if($size==0 || $size>2000)
header("../location:msg.php?num=10");
else
{
$dbhelper = new dbhelper();
$dbhelper->open();
$sql = "insert into image(src,content,time,flag) values ('image/$newname','$content',now(),2)";
$result = mysql_query($sql);
if($result==true)
{
move_uploaded_file($_FILES["photo"]["tmp_name"],$path);
header("location:../msg.php?num=11");
}
else
header("location:../msg.php?num=12");
$dbhelper->close();
}?>这是我的后台处理代码 帮我看看 求助~~
msg.php?num=10?
msg.php?num=11?
msg.php?num=12?还msg.php啊!自己设置的状态都是摆设吗?
我的跳转到msg.php带一个num参数有问题吗?
求详解 谢谢
$_SERVER["DOCUMENT_ROOT"]."/rlx/image/"
是否存在
但是不知道为什么header location 的跳转是“该页无法显示”
这个事为什么?怎么不能跳转页面了呢?<?php
date_default_timezone_set('prc');
include("../../dbhelper.php");
$name = $_FILES["photo"]["name"];
$size = $_FILES["photo"]["size"]/1024;
$type = strstr($name,".");
$newname = date("ymd_His")."_".rand(10,99).$type;
$path = $_SERVER["DOCUMENT_ROOT"]."/image/".$newname;
if(!preg_match("/JPG|GIF|PNG/i",$type))
header("location:../msg.php?num=9");
else if($size==0 || $size>2000)
header("location:../msg.php?num=10");
else
{
$dbhelper = new dbhelper();
$dbhelper->open();
$sql = "insert into image(src,time,flag) values ('image/$newname',now(),0)";
$result = mysql_query($sql);
if($result==true)
{
move_uploaded_file($_FILES["photo"]["tmp_name"],$path);
header("location:../msg.php?num=11");
}
else
header("location:../msg.php?num=12");
$dbhelper->close();
}
?>
你打印出跳转的路径看看就知道问题了。