how do i increase upload size for iis6

Hi there

I have setup a new web serve and find that I am unable to upload files larger than 4mb.  I am using a Windows 2003K Plesk based VPS, which I can remote into and have access to all directories.

I have changed the metabase.xml file to that I have 2700 seconds to perform a given task, plus setup PHP and set the timeouts to be the same 2700.

What other settings do I need to change to enable me to upload a file through a PHP site?

Regards
JakeSpencerAsked:
Who is Participating?
 
JakeSpencerAuthor Commented:
My FCGIEXE.INI looks like this

Where in the file do I put the variables below as i'm still getting timeout errors?

RequestTimeout=2700
ResponseBufferLimit=104857600

[Types]
php3:12079=Plesk_php5
php3:20782=Plesk_php5
php3:20884=Plesk_php5
php3:21885=Plesk_php5
php3:4829=Plesk_php5
php:12079=Plesk_php5
php:20782=Plesk_php5
php:20884=Plesk_php5
php:21885=Plesk_php5
php:4829=Plesk_php5
phtml:12079=Plesk_php5
phtml:20782=Plesk_php5
phtml:20884=Plesk_php5
phtml:21885=Plesk_php5
phtml:4829=Plesk_php5
php:23896=Plesk_php5
php3:23896=Plesk_php5
phtml:23896=Plesk_php5
php:4029=Plesk_php5
php3:4029=Plesk_php5
phtml:4029=Plesk_php5
php:6937=Plesk_php5
php3:6937=Plesk_php5
phtml:6937=Plesk_php5
php:7087=Plesk_php5
php3:7087=Plesk_php5
phtml:7087=Plesk_php5
[Plesk_php5]
ExePath=C:\Parallels\Plesk\Additional\PleskPHP5\php-cgi.exe
[Plesk_php]
ExePath=C:\Parallels\Plesk\Additional\PHP\php.exe

Open in new window

0
 
kevp75Commented:
0
 
Rick HobbsRETIREDCommented:
If you're using ASP .NET, then you need to modify the maxRequestLength web.config property.

Check here:

http://weblogs.asp.net/mhawley/archive/2004/05/11/129824.aspx
0
Cloud Class® Course: Microsoft Windows 7 Basic

This introductory course to Windows 7 environment will teach you about working with the Windows operating system. You will learn about basic functions including start menu; the desktop; managing files, folders, and libraries.

 
kevp75Commented:
You'll need to edit the Metabase.xml file, so you may be better to just do a iisreset /stop at a command prompt, make the edit as stated in the above, and then do a iisreset /start
0
 
kevp75Commented:
also....  you may want to up the value in php.ini.  there is a property called: upload_max_filesize
0
 
Ray PaseurCommented:
Here is a teaching example showing how to upload a file.  Please read the man page references, as well as the code, and post back with any questions.

Note the MAX_FILE_SIZE directive in the HTML form.  You may also want to run phpinfo() and look in the Core for post_max_size and upload_max_filesize.  You can usually change these via php_ini.
<?php // RAY_upload_example.php
error_reporting(E_ALL);


// MANUAL REFERENCE PAGES
// http://docs.php.net/manual/en/features.file-upload.php
// http://docs.php.net/manual/en/features.file-upload.common-pitfalls.php
// http://docs.php.net/manual/en/function.move-uploaded-file.php
// http://docs.php.net/manual/en/function.getimagesize.php


// PHP 5.1+  SEE http://us3.php.net/manual/en/function.date-default-timezone-set.php
date_default_timezone_set('America/Chicago');

// ESTABLISH THE NAME OF THE 'uploads' DIRECTORY
$uploads = 'RAY_junk';

// ESTABLISH THE BIGGEST FILE SIZE WE CAN ACCEPT - ABOUT 8 MB
$max_file_size = '8192000';

// ESTABLISH THE MAXIMUM NUMBER OF FILES WE CAN UPLOAD
$nf = 3;

// ESTABLISH THE KINDS OF FILE EXTENSIONS WE CAN ACCEPT
$file_exts = array
( 'jpg'
, 'gif'
, 'png'
, 'txt'
, 'pdf'
)
;

// LIST OF THE ERRORS THAT MAY BE REPORTED IN $_FILES[]["error"] (THERE IS NO #5)
$errors = array
( 0 => "Success!"
, 1 => "The uploaded file exceeds the upload_max_filesize directive in php.ini"
, 2 => "The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form"
, 3 => "The uploaded file was only partially uploaded"
, 4 => "No file was uploaded"
, 5 => "UNDEFINED ERROR"
, 6 => "Missing a temporary folder"
, 7 => "Cannot write file to disk"
)
;




// IF THERE IS NOTHING IN $_POST, PUT UP THE FORM FOR INPUT
if (empty($_POST))
{
    ?>
    <h2>Upload <?php echo $nf; ?> file(s)</h2>

    <!--
        SOME THINGS TO NOTE ABOUT THIS FORM...
        ENCTYPE IN THE HTML <FORM> STATEMENT
        MAX_FILE_SIZE MUST PRECEDE THE FILE INPUT FIELD
        INPUT NAME= IN TYPE=FILE DETERMINES THE NAME YOU FIND IN $_FILES ARRAY
        ABSENCE OF ACTION= ATTRIBUTE IN FORM TAG CAUSES POST TO SAME SCRIPT
    -->

    <form name="UploadForm" enctype="multipart/form-data" method="post">
    <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $max_file_size; ?>" />
    <p>
    Find the file(s) you want to upload and click the "Upload" button below.
    </p>

    <?php // CREATE INPUT STATEMENTS FOR UP TO $n FILE NAMES
    for ($n = 0; $n < $nf; $n++)
    {
        echo "<input name=\"userfile$n\" type=\"file\" size=\"80\" /><br/>\n";
    }
    ?>

    <br/>Check this box <input autocomplete="off" type="checkbox" name="overwrite" /> to <strong>overwrite</strong> existing files.
    <input type="submit" value="Upload" />
    </form>
    <?php
    die();
}
// END OF THE FORM SCRIPT



// WE HAVE GOT SOMETHING IN $_POST - RUN THE ACTION SCRIPT
else
{
    // THERE IS POST DATA - PROCESS IT
    echo "<h2>Results: File Upload</h2>\n";

    // ACTIVATE THIS TO SEE WHAT IS COMING THROUGH
    //    echo "<pre>"; var_dump($_FILES); var_dump($_POST); echo "</pre>\n";

    // ITERATE OVER THE CONTENTS OF $_FILES
    foreach ($_FILES as $my_uploaded_file)
    {
        // SKIP OVER EMPTY SPOTS - NOTHING UPLOADED
        $error_code    = $my_uploaded_file["error"];
        if ($error_code == 4) continue;

        // SYNTHESIZE THE NEW FILE NAME
        $f_type    = trim(strtolower(end    (explode( '.', basename($my_uploaded_file['name'] )))));
        $f_name    = trim(strtolower(current(explode( '.', basename($my_uploaded_file['name'] )))));
        $my_new_file = getcwd() . '/' . $uploads . '/' . $f_name . '.' . $f_type;
        $my_file     =                  $uploads . '/' . $f_name . '.' . $f_type;

        // OPTIONAL TEST FOR ALLOWABLE EXTENSIONS
        if (!in_array($f_type, $file_exts)) die("Sorry, $f_type files not allowed");

        // IF THERE ARE ERRORS
        if ($error_code != 0)
        {
            $error_message = $errors[$error_code];
            die("Sorry, Upload Error Code: $error_code: $error_message");
        }

        // GET THE FILE SIZE
        $file_size = number_format($my_uploaded_file["size"]);

        // IF THE FILE IS NEW (DOES NOT EXIST)
        if (!file_exists($my_new_file))
        {
            // IF THE MOVE FUNCTION WORKED CORRECTLY
            if (move_uploaded_file($my_uploaded_file['tmp_name'], $my_new_file))
            {
                $upload_success = 1;
            }
            // IF THE MOVE FUNCTION FAILED
            else
            {
                $upload_success = -1;
            }
        }

        // IF THE FILE ALREADY EXISTS
        else
        {
            echo "<br/><b><i>$my_file</i></b> already exists.\n";

            // SHOULD WE OVERWRITE THE FILE? IF NOT
            if (empty($_POST["overwrite"]))
            {
                $upload_success = 0;
            }
            // IF WE SHOULD OVERWRITE THE FILE, TRY TO MAKE A BACKUP
            else
            {
                $now    = date('Y-m-d');
                $my_bak = $my_new_file . '.' . $now . '.bak';
                if (!copy($my_new_file, $my_bak))
                {
                    echo "<br/><strong>Attempted Backup Failed!</strong>\n";
                }
                if (move_uploaded_file($my_uploaded_file['tmp_name'], $my_new_file))
                {
                    $upload_success = 2;
                }
                else
                {
                    $upload_success = -1;
                }
            }
        }

        // REPORT OUR SUCCESS OR FAILURE
        if ($upload_success == 2) { echo "<br/>It has been overwritten.\n"; }
        if ($upload_success == 1) { echo "<br/><strong>$my_file</strong> has been saved.\n"; }
        if ($upload_success == 0) { echo "<br/><strong>It was NOT overwritten.</strong>\n"; }
        if ($upload_success < 0)  { echo "<br/><strong>ERROR: $my_file NOT SAVED - SEE WARNING FROM move_uploaded_file() COMMAND</strong>\n"; }
        if ($upload_success > 0)
        {
            echo "$file_size bytes uploaded.\n";
            if (!chmod ($my_new_file, 0755))
            {
                echo "<br/>chmod(0755) FAILED: fileperms() = ";
                echo substr(sprintf('%o', fileperms($my_new_file)), -4);
            }
            echo "<br/><a href=\"$my_file\">See the file $my_file</a>\n";
        }
    // END FOREACH ITERATOR - EACH ITERATION PROCESSES ONE FILE
    }
}

Open in new window

0
 
JakeSpencerAuthor Commented:
Hello and thanks for the suggestions.

I have checked metabase.xml and confirmed a high enough size limit has been set in bytes.  I was able to upload an 8MB file, but a colleague who also has admin rights was unable to do the same for a 12MB file.

I thought it may be a timeout issue and have checked the settings in php.ini.  Whereas most are set to 2700, max_execution_time is set to 27000.  Is having such a large timeout likely to be the cause of the problems due to conflicts with other properties?

To reconfirm, the error received was a FastCGI error 995.

Thanks for your assistance.

Regards.

0
 
JakeSpencerAuthor Commented:
Hello there,

If it is of any addition use, I have the following values set to 27000 in FCGIEXT.ini:
ActivityTimeout
RequestTimeout

Thanks for any assistance.

Regards.
0
 
Rick HobbsRETIREDCommented:
0
 
kevp75Commented:
also....  you may want to up the value in php.ini.  there is a property called: upload_max_filesize
0
 
JakeSpencerAuthor Commented:
Hello there,

Thanks for all the links and suggestions so far.  I have tried all of the recommendations posted above but a solution still illudes me.

I thought I would confirm the settings I have at present:

Software:
Windows Server 2003
IIS 6.0
Plesk 10.1.1
FastCGI 7.7
PHP 5.2

The following settings are configured in the three configuration files I have been working with:

FCGIExt.ini
ActivityTimeout = 2700
RequestTimeout = 2700

PHP.ini
max_execution_time = 2700
max_input_time = 2700
post_max_size = 100M
upload_max_filesize = 100M

metabase.xml
AspMaxRequestEntityAllowed = 107374182400 (100 megabytes)

I have experienced the following results:
When uploading an 85MB file, I get the FastCGI error 995 after 6-7 mins
When uploading a 18MB file, I get the FastCGI error 995 after a much shorter time.  I am on a 7mbit connection.  Others have reported similar errors with smaller file sizes (12MB) on slower connections.

I have rebooted the server and IIS.  If anyone can advise, on anything else to try, I'd be extremely grateful.

Thanks in advance,

Regards.
0
 
JakeSpencerAuthor Commented:
Hi

I cannot find the 'ASPMaxRequestEntityAllowed' or 'AspBufferingLimit' variables in the metabase.xml file.  Where do I add them and should I be using the Metabase Explorer within the IIS Resources Kit rather than editing within Notepad?

I am still getting CGI errors when uploading large files and my site owner is now not happy they can't upload 'patch files' for their clients.  This is gettings rather serious and needs to be fixed ASAP.

Kind regards and thanks in advance
0
 
JakeSpencerAuthor Commented:
Eventually resolved this by placing the two timeout and data strings at the top of the file below the initial declarations. It seems the file is read and settings are used in order so as they were in the wrong location they were never being applied.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.