DO NOT DEAL WITH THIS MEMBER
So I was learning PHP the other day and figured I'd make a file uploader for my website.
It works very well with small files but as soon as I try to upload big files I see this progress thingy in my browser:
As soon as it finishes I should get a page with a link like this:
But it just redirects me to the upload page.
Code https://pastebin.com/xaSMqDLR
Also, I sometimes just get the "error" 'file can not be bigger than 1000mb (was '. $_FILES['file']['size'] . ')' on my page when I upload a gif. No idea why that happens.
Feb 6, 2019 04:59 AM
(This post was last modified: Feb 6, 2019 05:04 AM by +Haze.)
I mean, did you even attempt to Google the question before creating the thread? I just googled "PHP upload files larger than 100mb" and found answers.
DO NOT DEAL WITH THIS MEMBER
(Feb 6, 2019 04:59 AM)+Haze Wrote: I mean, did you even attempt to Google the question before creating the thread? I just googled "PHP upload files larger than 100mb" and found answers
The file I tried to upload wasn't bigger then 100mb though.
(Feb 6, 2019 05:01 AM)Lynx Wrote: The file I tried to upload wasn't bigger then 100mb though.
My bad, I apologise.
Well, that does sound very strange. Do you have a direct link to your website I can take a look at?
DO NOT DEAL WITH THIS MEMBER
(Feb 6, 2019 05:06 AM)+Haze Wrote: My bad, I apologise.
Well, that does sound very strange. Do you have a direct link to your website I can take a look at?
Oh. I changed those values in the php.ini file and it is working, i guess. But the other problem is this error:
PHP Code
<?php file can not be bigger than 1000mb (was 0)
very strange
(Feb 6, 2019 05:07 AM)Lynx Wrote: Oh. I changed those values in the php.ini file and it is working, i guess. But the other problem is this error:
PHP Code
<?php file can not be bigger than 1000mb (was 0)
very strange
Yeah that's the solution I found when I Googled the problem too.
To answer your second question
https://pastebin.com/xaSMqDLR
Code if(!$_FILES['file']['size'] < 1000000000){
Remove the not operator (!)
so it should be
Code if($_FILES['file']['size'] < 1000000000){
DO NOT DEAL WITH THIS MEMBER
(Feb 6, 2019 05:10 AM)+Haze Wrote: Yeah that's the solution I found when I Googled the problem too.
To answer your second question
https://pastebin.com/xaSMqDLR
Code if(!$_FILES['file']['size'] < 1000000000){
Remove the not operator (!)
so it should be
Code if($_FILES['file']['size'] < 1000000000){
Aha thank you. Thats the other problem solved. Now I got the same issue again.
[Wed Feb 6 15:58:22 2019] PHP Warning: POST Content-Length of 77313218 bytes exceeds the limit of 8388608 bytes in Unknown on line 0
That is the error code I get. I am pretty sure I changed the php.ini file though.
I will figure this one out myself, thanks for the help though!
Feb 6, 2019 10:10 AM
(This post was last modified: Feb 6, 2019 10:10 AM by +Haze.)
^ That error is saying that you're trying to post a HTTP request with the content length of 77MB, meanwhile the limit is 8MB.
You should check your web requests and see what they look like.
Are you sending the request properly?
Using correct headers?
Correct encoding type?
DO NOT DEAL WITH THIS MEMBER
(Feb 6, 2019 10:10 AM)+Haze Wrote: ^ That error is saying that you're trying to post a HTTP request with the content length of 77MB, meanwhile the limit is 8MB.
You should check your web requests and see what they look like.
Are you sending the request properly?
Using correct headers?
Correct encoding type?
Yes I know what the error meant but I forgot to restart the server. At least... the correct server haha.
All working fine now. Thank you for the help 🤝
Just as a head's up, you may need to increase your max_input_time directive. By default, per the documentation, it'll use whatever your max_execution_time setting is. I wouldn't advise changing that though. The max_input_time directive is specifically for parsing input data- such as the file(s) being uploaded.
Also, and I'm assuming you fixed this if you're no longer having issues, be mindful of post_max_size. Per the documentation, make sure it exceeds your upload_max_filesize setting. The post_max_size looks at the entirety of the form submission, including submitted fields beside the upload (if you have any). You could run into an issue, for example, if post_max_size equaled upload_max_filesize, uploaded a file right around the maximum size, but also had some input fields that caused the form submit data to exceed the total allowed size. It's an edge case, but easy to avoid.
DO NOT DEAL WITH THIS MEMBER
(Feb 6, 2019 08:59 PM)Disease Wrote: Just as a head's up, you may need to increase your max_input_time directive. By default, per the documentation, it'll use whatever your max_execution_time setting is. I wouldn't advise changing that though. The max_input_time directive is specifically for parsing input data- such as the file(s) being uploaded.
Also, and I'm assuming you fixed this if you're no longer having issues, be mindful of post_max_size. Per the documentation, make sure it exceeds your upload_max_filesize setting. The post_max_size looks at the entirety of the form submission, including submitted fields beside the upload (if you have any). You could run into an issue, for example, if post_max_size equaled upload_max_filesize, uploaded a file right around the maximum size, but also had some input fields that caused the form submit data to exceed the total allowed size. It's an edge case, but easy to avoid.
Thanks, fixed it already but I appreciate the help
|