Asked  7 Months ago    Answers:  5   Viewed   29 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

92
  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.

Wednesday, March 31, 2021
 
Alix
answered 7 Months ago
19

Maybe this can come from apache limitations on POST size:

http://httpd.apache.org/docs/current/mod/core.html#limitrequestbody

It seems this limitation on 2Gb can be greater on 64bits installations, maybe. And i'm not sure setting 0 in this directove does not reach the compilation limit. see for examples that thread:

http://ubuntuforums.org/archive/index.php/t-1385890.html

Then do not forget to alter as well the max_input_time in PHP.

But you are reaching high limits :-) maybe you could try a rich client (flash? js?) on the browser side, doing the transfer in chunks or some sort of FTP things, with progress indicators for the user.

Wednesday, March 31, 2021
 
cegfault
answered 7 Months ago
89

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, March 31, 2021
 
rlanvin
answered 7 Months ago
59

I thought a session is stored on the server, instead of the client? Than why do I have IE grant access to my domain? (http://www.pcwindowstips.com/2007/09/04/how-to-enable-cookies-in-internet-explorer-7/)

The way sessions work is that a session cookie is stored for the site, which contains your session ID. The only way the server knows who you are is when it reads the session ID cookie on every page load. All of the $_SESSION data is stored on the server for each user, but the cookie must be set for the server to know which $_SESSION data to retrieve.

This is also why you can essentially "become" another user if you obtain their session id cookie.

Saturday, May 29, 2021
 
Optimus
answered 5 Months ago
19
mail($to, "Subject: $subject",$message );
echo "Thank you for using our mail form";

instead of this ,first check if the mail is sent

$mail=mail($to, "Subject: $subject",$message );
if($mail){
  echo "Thank you for using our mail form";
}else{
  echo "Mail sending failed."; 
}

By this actually u can know whether your mail function in working or not

if it is not working.the problem can be with SMTP settings in your localhost

enable errors in php if not enabled using

ini_set('display_errors',1);
Tuesday, July 6, 2021
 
Pupil
answered 4 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :