user3814785
user3814785

Reputation: 23

Uploading files to server using php

I can successfully upload files upto 3-4 MB. But when I try to upload files greater than 4 MB, it starts upload for sometime and then shows "This webpage is not available" error. I have hosted the site in 000webhost. But in localhost, I can easily upload larger files as well. Please help me out of this.

Upvotes: 1

Views: 102

Answers (2)

Sysaxiom
Sysaxiom

Reputation: 1

I believe that you have

  1. Enough permission to upload files

  2. And increased upload_max_filesize and post_max_size

upload_max_filesize = 40M

post_max_size = 40M

Note :

000webhost.com is a free hosting site and you can't expect good speed and it would fail in most cases. If you want to see good response better try in a paid hosting or try in some free app hosters like heroku

Update according to user's Comment :

I can do that in localhost. But where can I find the php.ini file as I have already hosted the site

You can't find the php.ini in online server. But you can set it using .htaccess files and other few ways..

Create a .htaccess file and inside it have the following code, then you can achieve your need.

php_value upload_max_filesize 40M
php_value post_max_size 40M

Upvotes: 0

MilanG
MilanG

Reputation: 7114

You need to set the value of upload_max_filesize and post_max_size in your php.ini :

; Maximum allowed size for uploaded files.
upload_max_filesize = 40M

; Must be greater than or equal to upload_max_filesize
post_max_size = 40M

(and restart apache)

Upvotes: 1

Related Questions