无法在mozilla firefox 8.0上传照片

时间:2011-12-05 06:37:08

标签: php html firefox

我创建了一个简单的表单。在表单中有一个上传照片的选项。我已创建并成功提交。但是当我将mozilla firefox浏览器更新为8.0表格时显示问题。当我在firefox 8.0中提交表单时,浏览器挂起只是因为上传照片部分,所有其他工作正常,而相同的代码在Internet Explorer中运行。然后我安装了旧版本的firefox,同样的代码运行良好。我不明白为什么会这样,解决方案是什么?请帮我。提前谢谢......

这是代码......

<?php
session_start();
if(!isset($_SESSION['user']))
    {
        header("Location:index.php");
        exit();
    }
  include("./include/dbc.php");
 $msg='';

if(isset($_POST['check'])){
    $p=$_FILES['photo']['name'];
    $q=$_FILES['photo1']['name'];
  if($_REQUEST['a_name'] == '' ||$_REQUEST['b_name'] == ''||$_REQUEST['no_flats'] == ''||$p == ''||$q == '')
{
    $msg='Enter Details!!';
}
if($msg==''){
    $target = "images/";
    $target = $target . basename( $_POST['a_name'].$_FILES['photo']['name']);
    $pic=$_POST['a_name'].$_FILES['photo']['name'];

    $target1 = "loc_images/";
    $target1 = $target1 . basename( $_POST['a_name'].$_FILES['photo1']['name']);
    $pic1=$_POST['a_name'].$_FILES['photo1']['name'];

    $time=$_POST['month'].'  '.$_POST['year'];
   $sql= "INSERT INTO flats
        SET
        app_name = '$_REQUEST[a_name]',
        builder = '$_REQUEST[b_name]',
        loc_id = '$_REQUEST[loc]',
        status_id = '$_REQUEST[status]',
        no_of_flats = '$_REQUEST[no_flats]',
        completion_time = '$time',
        main_pic = '$pic',
        loc_map = '$pic1'";
        $result=mysql_query($sql) or die(mysql_error());
        move_uploaded_file($_FILES['photo']['tmp_name'], $target);
        move_uploaded_file($_FILES['photo1']['tmp_name'], $target1);

        $id=$_REQUEST['a_name'];
$sql2 =mysql_query("select id from flats where app_name='$id'");
while ($result= mysql_fetch_row($sql2)){
   $_SESSION['flat_id']=$result[0];
    }
    header("Location:new1.php");
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<form id="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Welcome To Prime Properties</title>
<link rel="stylesheet" href="style.css" type="text/css"/>

</head>

<body>
   <div class="container">
        <div class="heading">
            <div class="banner"><img src="../images/top.jpg" width="995" height="169" /></div>
        <!--menu start-->
            <div>
                <?php  include('include/menu.php');?>
                </div>
        <!--menu end-->

        </div>
        <div class="main">
        <!--left menu start-->
            <div class="left_menu">
            <?php  include('include/lm.php');?>
            </div>
        <!--left menu end-->
        <div class="divider"></div>
        <!--body contant goes here-->
        <div class="right">
                    <div id="error">
                    <?php
                    echo $msg;
                    ?></div>
                    <p>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Enter Your Credentials......</p>
                       <fieldset><p class="first">
                               <label for="a_name">Appartment Name:</label>
                                <input type="text" name="a_name" id="a_name"><br/></input></p>
            <p>
                            <label for="b_name">Builder Name:</label>
                            <input type="text" name="b_name" id="b_name"><br/></input></p>
                        <p>
                         <label for="loc">Location:</label>
                         <select name="loc">
                            <option value="1">Maligaon</option>
                            <option value="2">Panbazaar</option>
                            <option value="3">Fancy Bazar</option>
                            <option value="4">Kahilipara</option>
                            <option value="5">Noonmati</option>
                            <option value="6">Lokhra</option>
                            <option value="7">Jalukbari</option>
                            <option value="8">Chandmari</option>
                            <option value="9">Beltola</option>
                            <option value="10">Dispur</option>
                        </select><br/></p>
                        <p>
                            <label for="status"> Status:</label>
                            <select name="status">
                            <option value="1">Ongoing</option>
                            <option value="2">Future</option>
                            <option value="3">Completed</option>
                        </select><br/></p>
                           <p><label for="no_flats">No of Flats:</label>
                              <input type="text" name="no_flats" id="no_flats"><br/></input></p>
                        <p><label for="c_time">Completion Time:</label>
                            <select name="month">
                                <option>Month</option>
                                <option>January</option>
                                <option>February</option>
                                <option>March</option>
                                <option>April</option>
                                <option>May</option>
                                <option>June</option>
                                <option>July</option>
                                <option>August</option>
                                <option>September</option>
                                <option>October</option>
                                <option>November</option>
                                <option>December</option>
                                </select>
                            <select name="year">
                                <option>Year</option>
                                <option>2012</option>
                                <option>2013</option>
                                <option>2014</option>
                                <option>2015</option>
                                <option>2016</option>
                                <option>2017</option>
                                <option>2018</option>
                                <option>2019</option>
                                <option>2020</option>
                            </select>
                                </p>
                        <p><label for="m_pic">Main Picture:</label>
                            <input type="file" name="photo"/><br/></p>
                        <p><label for="l_map">Location Map:</label>
                            <input type="file" name="photo1"/><br/></p>
                           <p class="submit">
                               <input type="hidden" name="check" value="1"/>
                               <button type="submit" name="submit" >NEXT</button></p>
                       </fieldset></div>

        <!--body contant end here -->
    </div>
   </div>

</body>
</html>
</form>

1 个答案:

答案 0 :(得分:0)

您:

<form id="form1" action="<?php echo $_SERVER['PHP_SELF'];?>" method="post" enctype="multipart/form-data">

不能在<body>之外,你甚至在<head>以外的地方停留了你的<form></form>。 尽量只在{{1}}标记中包含您需要的内容。

这很可能就是问题!