-2

I am making a basic website where you can sign up and login. Everything is working fine, except for uploading an image file to use as a profile picture. Whenever the file is around 300+ MB and I submit the form, the page keeps loading and eventually gives me

'502: Bad Gateway'

as an error.

I already tried changing the max_file_size in my php.ini, but this did not change anything. I also tried increasing the memory_limit in the php.ini, but again, this did not fix my problem

EDIT 1:
I am getting the

502: Bad Gateway

error still whenever I use PhpStorm. When I am uploading it my NAS (which has PhpMyAdmin and Apache installed) everything works good from there. I changed the settings in my php.ini, but this did not give me any other result.

EDIT 2: The post was edited and said that it has been answered already, but this is not the case. I am still having the same problem.

EDIT 3: The problem has been solved. It was due to the security that was setup on my NAS. Changing the settings here and there solved the issue.

Nosai
  • 55
  • 10

1 Answers1

1

In php.ini you need to set both of the following values:

; Maximum size of POST data that PHP will accept.
; http://php.net/post-max-size
post_max_size=300M

; ... more ini stuff...

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

That should fix your uploading probelm.

  • 1
    They're trying to upload a 300M+ file here and we don't know what they're using neither. 128M will fail. Edit: I see you edited. This comment as per original post https://stackoverflow.com/revisions/45306187/1 – Funk Forty Niner Jul 25 '17 at 14:29
  • I just copied and pasted out of my local php.ini file, thinking that he could pick up on the fact that those values needed to be changed. But I changed them just in case. – George Edward Shaw IV Jul 25 '17 at 14:33
  • 1
    Plus, for most users, you will most likely need to add onto the max execution time as well. – M. Eriksson Jul 25 '17 at 14:33
  • I edited my above comment. @GeorgeShaw – Funk Forty Niner Jul 25 '17 at 14:33
  • This is not the fix to my problem. I think it is a PhpStorm issue, because I am not getting this problem when I upload the files to my NAS webserver and open the page from there. – Nosai Jul 27 '17 at 12:30