Viewed   144 times

Possible Duplicate:
overriding upload_max_filesize

i use these code for change upload file size :-

echo ini_get('upload_max_filesize').'<br/>';
ini_set("upload_max_filesize","300M");
echo ini_get("upload_max_filesize");

BUT I GOT

2M
2M

which is set in php.ini.

i want to change file upload size limit.

 Answers

3
  1. http://php.net/manual/en/ini.list.php

upload_max_filesize "2M" PHP_INI_PERDIR

  1. http://php.net/manual/en/configuration.changes.modes.php

PHP_INI_PERDIR Entry can be set in php.ini, .htaccess, httpd.conf or .user.ini (since PHP 5.3)

So you can't use ini_set for this.

Friday, October 28, 2022
1

Try this one:

$date_time = '05-23-2017 01:00';

$newdatetime = str_replace('-', '/', $date_time);

echo date('Y-m-d H:i:s', strtotime($newdatetime));

// Output: 2017-05-23 01:00:00

The strtotime documentation reads:

Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed.

Saturday, September 24, 2022
 
3

NOTE: For more complete options see How can I upload files asynchronously?


Sending files via ajax requires some more special settings and also the use of FormData

submitHandler: function (form) {
    var formData = new FormData(form);

    $.ajax({
        url: 'proc/add_faculty.php',
        type: 'POST',
        data: formData,
        contentType: false,
        processData: false
        success: function (data) {
            if (data === '0') { // Everything Successful
                $("#loader-modal").modal('hide');
                $("#success-modal").modal("show");
                $(this).clearFormFields("#faculty-add");
            } else {
                if (data === '-1') { // dB Update failed
                    $("#loader-modal").modal('hide');
                    $("#failure-modal").modal("show");
                } else {
                    if (data === '-2') { // File Upload failed
                        $("#loader-modal").modal('hide');
                        $("#upload-fail-modal").modal("show");
                    } else {
                        $("#loader-modal").modal('hide');
                        $("#upload-fail-modal").modal("show");
                    }
                }

                $(this).clearFormFields("#faculty-add");
            }

        },
        error: function (XMLHttpRequest, textStatus, errorThrown) {
            $("#loader-modal").modal('hide');
            $("#failure-modal").modal("show");
            $(this).clearFormFields("#faculty-add");
        }

    });
}
Wednesday, September 28, 2022
5

Some providers does not allow you change certain values in running time. Instead of this, try to either change it in the real php.ini file or use an .htaccess (For Apache web servers) where you can add your configuration. You can find more information in the PHP.net article about this subject: How to change configuration settings.

Based on your story, example .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>
Wednesday, December 14, 2022
 
msc
 
msc
3

We were seeing this exact issue with the Goolge public DNS servers. We fixed it by simply restarting PHP-FPM. This issue has been the topic of some twitter disucssions:

https://twitter.com/laravelphp/status/844181376224165890

However is does not seem to be DigitalOcean specific.

Sunday, December 11, 2022
 
Only authorized users can answer the search term. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :