Docker with php, file upload failed, $_FILE is empty









up vote
1
down vote

favorite












Strange is, upload failed just at local env, it work on production and dev env. All of these use docker to run the project, and l checked my local php.ini in docker. it was set correctly, here is some info about my file upload



post data:



------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="Filename"

test.pdf
------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="PHPSESSID"

<?php echo session_id(); ?>
------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="fileNameFormat"

timerand:6
------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="upfile"; filename="test.pdf"
Content-Type: application/octet-stream


------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="Upload"

Submit Query
------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5--


php section:



<?php var_dump($_FILE);?>


result:



NULL


part setting of my php.ini



post_max_size = 2000M

max_input_time = 6000000000000000000000000000000000000000000

memory_limit = 1280M

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
; http://php.net/file-uploads
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
;upload_tmp_dir =

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 2000M

; Maximum number of files that can be uploaded via a single request
max_file_uploads = 2000000000000000000000000000000000000000000









share|improve this question























  • Is the request content-type set to multipart/form-data?
    – Phil
    Nov 12 at 4:38










  • Oh, it's $_FILES, not $_FILE
    – Phil
    Nov 12 at 4:39











  • @Phil sorry my fault, l will edit it. And l need to check the content-type, it is a flash file upload pulgin
    – afraid.jpg
    Nov 12 at 4:41










  • @Phil l found the case of problem, because of setting of max_input_time and upload_max_filesize , this two setting is too large
    – afraid.jpg
    Nov 12 at 6:03















up vote
1
down vote

favorite












Strange is, upload failed just at local env, it work on production and dev env. All of these use docker to run the project, and l checked my local php.ini in docker. it was set correctly, here is some info about my file upload



post data:



------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="Filename"

test.pdf
------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="PHPSESSID"

<?php echo session_id(); ?>
------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="fileNameFormat"

timerand:6
------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="upfile"; filename="test.pdf"
Content-Type: application/octet-stream


------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="Upload"

Submit Query
------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5--


php section:



<?php var_dump($_FILE);?>


result:



NULL


part setting of my php.ini



post_max_size = 2000M

max_input_time = 6000000000000000000000000000000000000000000

memory_limit = 1280M

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
; http://php.net/file-uploads
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
;upload_tmp_dir =

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 2000M

; Maximum number of files that can be uploaded via a single request
max_file_uploads = 2000000000000000000000000000000000000000000









share|improve this question























  • Is the request content-type set to multipart/form-data?
    – Phil
    Nov 12 at 4:38










  • Oh, it's $_FILES, not $_FILE
    – Phil
    Nov 12 at 4:39











  • @Phil sorry my fault, l will edit it. And l need to check the content-type, it is a flash file upload pulgin
    – afraid.jpg
    Nov 12 at 4:41










  • @Phil l found the case of problem, because of setting of max_input_time and upload_max_filesize , this two setting is too large
    – afraid.jpg
    Nov 12 at 6:03













up vote
1
down vote

favorite









up vote
1
down vote

favorite











Strange is, upload failed just at local env, it work on production and dev env. All of these use docker to run the project, and l checked my local php.ini in docker. it was set correctly, here is some info about my file upload



post data:



------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="Filename"

test.pdf
------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="PHPSESSID"

<?php echo session_id(); ?>
------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="fileNameFormat"

timerand:6
------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="upfile"; filename="test.pdf"
Content-Type: application/octet-stream


------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="Upload"

Submit Query
------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5--


php section:



<?php var_dump($_FILE);?>


result:



NULL


part setting of my php.ini



post_max_size = 2000M

max_input_time = 6000000000000000000000000000000000000000000

memory_limit = 1280M

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
; http://php.net/file-uploads
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
;upload_tmp_dir =

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 2000M

; Maximum number of files that can be uploaded via a single request
max_file_uploads = 2000000000000000000000000000000000000000000









share|improve this question















Strange is, upload failed just at local env, it work on production and dev env. All of these use docker to run the project, and l checked my local php.ini in docker. it was set correctly, here is some info about my file upload



post data:



------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="Filename"

test.pdf
------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="PHPSESSID"

<?php echo session_id(); ?>
------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="fileNameFormat"

timerand:6
------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="upfile"; filename="test.pdf"
Content-Type: application/octet-stream


------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5
Content-Disposition: form-data; name="Upload"

Submit Query
------------KM7GI3GI3Ef1ei4ae0gL6GI3GI3Ij5--


php section:



<?php var_dump($_FILE);?>


result:



NULL


part setting of my php.ini



post_max_size = 2000M

max_input_time = 6000000000000000000000000000000000000000000

memory_limit = 1280M

;;;;;;;;;;;;;;;;
; File Uploads ;
;;;;;;;;;;;;;;;;

; Whether to allow HTTP file uploads.
; http://php.net/file-uploads
file_uploads = On

; Temporary directory for HTTP uploaded files (will use system default if not
; specified).
; http://php.net/upload-tmp-dir
;upload_tmp_dir =

; Maximum allowed size for uploaded files.
; http://php.net/upload-max-filesize
upload_max_filesize = 2000M

; Maximum number of files that can be uploaded via a single request
max_file_uploads = 2000000000000000000000000000000000000000000






php docker






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 at 3:08

























asked Nov 12 at 2:39









afraid.jpg

528




528











  • Is the request content-type set to multipart/form-data?
    – Phil
    Nov 12 at 4:38










  • Oh, it's $_FILES, not $_FILE
    – Phil
    Nov 12 at 4:39











  • @Phil sorry my fault, l will edit it. And l need to check the content-type, it is a flash file upload pulgin
    – afraid.jpg
    Nov 12 at 4:41










  • @Phil l found the case of problem, because of setting of max_input_time and upload_max_filesize , this two setting is too large
    – afraid.jpg
    Nov 12 at 6:03

















  • Is the request content-type set to multipart/form-data?
    – Phil
    Nov 12 at 4:38










  • Oh, it's $_FILES, not $_FILE
    – Phil
    Nov 12 at 4:39











  • @Phil sorry my fault, l will edit it. And l need to check the content-type, it is a flash file upload pulgin
    – afraid.jpg
    Nov 12 at 4:41










  • @Phil l found the case of problem, because of setting of max_input_time and upload_max_filesize , this two setting is too large
    – afraid.jpg
    Nov 12 at 6:03
















Is the request content-type set to multipart/form-data?
– Phil
Nov 12 at 4:38




Is the request content-type set to multipart/form-data?
– Phil
Nov 12 at 4:38












Oh, it's $_FILES, not $_FILE
– Phil
Nov 12 at 4:39





Oh, it's $_FILES, not $_FILE
– Phil
Nov 12 at 4:39













@Phil sorry my fault, l will edit it. And l need to check the content-type, it is a flash file upload pulgin
– afraid.jpg
Nov 12 at 4:41




@Phil sorry my fault, l will edit it. And l need to check the content-type, it is a flash file upload pulgin
– afraid.jpg
Nov 12 at 4:41












@Phil l found the case of problem, because of setting of max_input_time and upload_max_filesize , this two setting is too large
– afraid.jpg
Nov 12 at 6:03





@Phil l found the case of problem, because of setting of max_input_time and upload_max_filesize , this two setting is too large
– afraid.jpg
Nov 12 at 6:03













1 Answer
1






active

oldest

votes

















up vote
1
down vote













set the max_input_time and upload_max_filesize to a common value, like 3000. these two setting's value is too large case php can't admit it. l reset these setting into 3000, and restart the container, done it. Now file upload can work successfully.






share|improve this answer




















    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53255329%2fdocker-with-php-file-upload-failed-file-is-empty%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    1
    down vote













    set the max_input_time and upload_max_filesize to a common value, like 3000. these two setting's value is too large case php can't admit it. l reset these setting into 3000, and restart the container, done it. Now file upload can work successfully.






    share|improve this answer
























      up vote
      1
      down vote













      set the max_input_time and upload_max_filesize to a common value, like 3000. these two setting's value is too large case php can't admit it. l reset these setting into 3000, and restart the container, done it. Now file upload can work successfully.






      share|improve this answer






















        up vote
        1
        down vote










        up vote
        1
        down vote









        set the max_input_time and upload_max_filesize to a common value, like 3000. these two setting's value is too large case php can't admit it. l reset these setting into 3000, and restart the container, done it. Now file upload can work successfully.






        share|improve this answer












        set the max_input_time and upload_max_filesize to a common value, like 3000. these two setting's value is too large case php can't admit it. l reset these setting into 3000, and restart the container, done it. Now file upload can work successfully.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 12 at 6:07









        afraid.jpg

        528




        528



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53255329%2fdocker-with-php-file-upload-failed-file-is-empty%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            How to read a connectionString WITH PROVIDER in .NET Core?

            In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

            Museum of Modern and Contemporary Art of Trento and Rovereto