我在这里需要一些建议/协助。 我正在尝试上传图像,但wampserver继续向我显示此错误(警告:80237字节的POST内容长度超出了未上传的0行上的“未知”中的750字节的限制! ),但是我尝试更改php.ini设置,但还是一样,如果有人可以在这里提供帮助,我们将不胜感激。 谢谢

这是我的代码

  <!doctype html>
  <html>
  <head lang="en">
<meta charset="utf-8">
<title>Ajax Image Upload with jQuery - w3bees.com</title>
<!-- scripts -->
<script type="text/javascript" src="js/jquery.7.1.min.js"></script>
<script type="text/javascript" src="js/jquery.form.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<style>
a, h1{
    font-family: Georgia, "Times New Roman", Times, serif;
    font-size: 170%;
    color: #645348;
    font-style: italic;
    text-decoration: none;
    font-weight: 100;
    padding: 10px;
}
body{
    font: 14px Arial,Tahoma,Helvetica,FreeSans,sans-serif;
    text-transform: inherit;
    color: #582A00;
    background: #E7EDEE;
    width: 100%;
    margin: 0;
    padding: 0;
}
.wrap{
    width: 700px;
    margin: 10px auto;
    padding: 10px 15px;
    background: white;
    border: 2px solid #DBDBDB;
    -webkit-border-radius: 5px;
    -moz-border-radius: 5px;
    border-radius: 5px;
    text-align: center;
    overflow: hidden;
}
#preview {
    color: red;
}
#preview img{
    margin-top: 30px;
    max-width: 100%;
    border: 0;
    border-radius: 3px;
    -webkit-box-shadow: 0px 2px 7px 0px rgba(0, 0, 0, .27);
    box-shadow: 0px 2px 7px 0px rgba(0, 0, 0, .27);
    overflow: hidden;
}
input[type="submit"]{
    border-radius: 10px;
    background-color: #61B3DE;
    border: 0;
    color: white;
    font-weight: bold;
    font-style: italic;
    padding: 6px 15px 5px;
    cursor: pointer;
}
</style>
  </head>
  <body>
  <div class="wrap">
<h1><a href="">Ajax Image Upload with jQuery</a></h1>
<p>Valid formats: jpeg, gif, png, Max upload: 200kb</p>
<!-- loader.gif -->
<img style="display:none" id="loader" src="loader.gif" alt="Loading...." title="Loading...." />
<!-- simple file uploading form -->
<form id="form" action="ajaxupload.php" method="post" enctype="multipart/form-data">
    <input id="uploadImage" type="file" accept="image/*" name="image" />
    <input id="button" type="submit" value="Upload">
</form>
<!-- preview action or error msgs -->
<div id="preview" style="display:none"></div>
<p>&copy W3bees.com 2013</p>
   </div><!--wrap-->
   </body>
   </html>

Ajax上传代码:

   <?php

   $valid_exts = array('jpeg', 'jpg', 'png', 'gif'); // valid extensions
   $max_size = 2000000 * 1024; // max file size
   $path = 'uploads/'; // upload directory

   if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if( ! empty($_FILES['image']) ) {
    // get uploaded file extension
    $ext = strtolower(pathinfo($_FILES['image']['name'], PATHINFO_EXTENSION));
    // looking for format and size validity
    if (in_array($ext, $valid_exts) AND $_FILES['image']['size'] < $max_size) {
        $path = $path . uniqid(). '.' .$ext;
        // move uploaded file from temp to uploads directory
        if (move_uploaded_file($_FILES['image']['tmp_name'], $path)) {
            echo "<img src='$path' />";
        }
    } else {
        echo 'Invalid file!';
    }
} else {
    echo 'File not uploaded!';
}
    } else {
echo 'Bad request!';
    }

    ?>


  wampserver version 2.4
  php.ini 5.4.12

  max_execution_time = 600000  
  max_input_time = 600000
  memory_limit = 1000M
  post_max_size = 750MB;
  upload_max_filesize = 750M;

===============>>#1 票数:0

检查您的phpinfo()参见此部分:

Loaded Configuration File

就我而言

/etc/php5/apache2/php.ini   

并查看是否在编辑重新启动apache后重新编辑php.ini文件后是否编辑了正确的php.ini文件

  ask by user3379528 translate from so

未解决问题?本站智能推荐: