English 中文(简体)
php提出1号上载错误——使用php的正确方法是什么?
原标题:php file upload error of 1 - What is correct way to use php_ini?

我有问题把一个自动发射台上载到我的服务器。 顶峰——最大化物为2M,而文档则更接近4M。 我发现有一个与这里的地雷问题类似的员额。

https://stackoverflow.com/questions/4255617/file-upload-large-file-gives-error-1-even-though-upload-max-size-is-bigger-tha>$_FILE upload large file 差错1,尽管上载-max_size大于文件

我可以从Sander.net那里收集,用于正确使用惯用指挥部,这是我目前正在使用的。

    ini_set( upload_max_filesize , 100000000);
    ini_set( post_max_size , 110000000);
    ini_set( memory_limit , 120000000);
    ini_set( max_input_time , 20);

但是,在我的联系中,似乎他们正在使用一种不同的方法(如果它们只是总结正确的法典)。 但 我的法典似乎也没有发挥作用。 我有<代码><?php phpinfo(); ?>,在我的网页底部,它说,上载-最大化仍然是2M。 Am I 采用正确的yn子进行内乱吗? 或者,我的问题是,用上手法,什么?

我处理上载的代码是

    //======================pdf upload=====================     
    if ($_POST[ erasePDF ] == "Yes") //checking if erase box was checked and erasing if true
    {   
        if (file_exists($pdf))
        {
            unlink( $pdf );
            $pdf = "";
        }
    }   

    print_r($_FILES[ pdf ]);
    if (!empty($_FILES[ pdf ][ name ])) //checking if file upload box contains a value
    {
        $saveDirectoryPDF =  pdfs/ ;            //name of folder to upload to
        $tempName = $_FILES[ pdf ][ tmp_name ]; //getting the temp name on server
        $pdf = $_FILES[ pdf ][ name ];      //getting file name on users computer

        $test = array();
        $test = explode(".", $pdf);
        if((count($test) > 2) || ($test[1] != "pdf" && $test[1] != "doc" && $test[1] != "docx")){
            echo "invalid file";
        }else{

            $count = 1;
            do{
            $location = $saveDirectoryPDF . $count . $pdf;
            $count++; 
            }while(is_file($location));

            if (move_uploaded_file($tempName, $location))   //Moves the temp file on server
            {                                                           //to directory with real name
                $pdf = $location;
            } 
            else 
            {

                echo "hi";
                echo  <h1> There was an error while uploading the file.</h1> ;
            }
        }
    }else{
        $pdf = "";
    }
    if(isset($_POST[ link ]) && $_POST[ link ] != ""){
        $pdf = $_POST[ link ];
    }
    //======================end of pdf upload==============

a. 字面打印机($_FILES[ pdf]);

    Array ( [name] => takeoutmenu.pdf [type] => [tmp_name] => [error] => 1 [size] => 0 )
最佳回答

一些供应商不允许你改变某些价值。 不是这样,而是试图在真正的Sphp.ini文档中加以改动,或者使用你能够增加配置的“htaccess”(“Forpa”网络服务器)。 你们可以在项目组合中找到更多的信息。 与此相关的条款净额: 如何改变配置环境

根据你的故事,例如,htaccess

<IfModule mod_php5.c>
php_value upload_max_filesize 100000000
php_value post_max_size 110000000
php_value memory_limit 120000000
php_value max_input_time 20
</IfModule>
问题回答

暂无回答




相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签