{"id":673,"date":"2016-06-13T21:14:01","date_gmt":"2016-06-13T21:14:01","guid":{"rendered":"https:\/\/www.copahost.com\/blog\/?p=673"},"modified":"2020-05-31T14:13:20","modified_gmt":"2020-05-31T14:13:20","slug":"php-upload-max-filesize","status":"publish","type":"post","link":"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/","title":{"rendered":"How to solve the error upload_max_filesize in PHP"},"content":{"rendered":"<p>If you own a website where users are allowed to upload files, you might often get complaints stating that they are unable to upload files. They would be hitting an error as follows:<\/p>\n<p>&#8220;Error: The uploaded file exceeds the upload_max_filesize directive in php.ini&#8221;<\/p>\n<p>upload_max_filesize mentioned in the error above is the limit of the size of a file that can be uploaded to the server. The default value is normally 2M in all servers, and when someone tries to <a href=\"https:\/\/www.copahost.com\/blog\/php-upload-multiple-files\/\">upload a file<\/a> greater than 2M this error is obtained.<\/p>\n<h3>How to solve the error upload_max_filesize<\/h3>\n<p>Users can change the value of upload_max_filesize from their cPanel itself and this post describes how to do that. First, log in to your <a href=\"https:\/\/www.copahost.com\/blog\/create-cpanel-reseller-hosting-account-whm\/\" >cPanel account<\/a> using the cPanel login details.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php1.jpg\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-647\" src=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php1.jpg\" alt=\"php1\" width=\"1113\" height=\"603\" \/><\/a><\/p>\n<p>Once you are in the dashboard, go to Software -&gt; Select <a href=\"https:\/\/www.copahost.com\/blog\/check-update-php-version-cpanel\/\" >PHP Version<\/a>. It will take you to a page where you can select the PHP version and other PHP extensions. To the top right, you will notice an option &#8216;Switch to PHP Options&#8217;.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php6.jpg\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-657\" src=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php6.jpg\" alt=\"php6\" width=\"1337\" height=\"634\" \/><\/a><\/p>\n<p>Click on that option and you will find a list of PHP options that you can configure. To the bottom of the list, you will find upload_max_filesize. To its right, there is a drop down box with various sizes to choose from. Choose the value you require and hit &#8216;Apply&#8217;. Beneath it is a &#8216;Save&#8217; button, click on it.<\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php13.jpg\"><img decoding=\"async\" class=\"aligncenter wp-image-674 size-full\" src=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php13.jpg\" alt=\"upload_max_filesize\" width=\"1339\" height=\"625\" \/><\/a><\/p>\n<p>For example, I choose 64M.\u00a0 Before confirming the changes, you also need to consider the option &#8216;post_max_size&#8217;. If the size of the total upload exceeds the default 8M, it will again hit an error. Hence, it is advisable to raise the value of post_max_size also on the same page.<\/p>\n<p>Now, let us confirm the changes we made by uploading a phpinfo page. Create a file, say for example info.php with the following contents and upload it to the public_html folder of your domain.<\/p>\n<pre class=\"lang:default decode:true \">&lt;?php\r\n\r\nphpinfo();\r\n\r\n?&gt;<\/pre>\n<p>My domain is copablog.com and now I can access the file in a browser as http:\/\/copablog.com\/info.php. Search for upload_max_filesize and check the value. I can see that it has changed to 64M.<\/p>\n<p><a href=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php14.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-675 size-full\" src=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php14.jpg\" alt=\"upload_max_filesize\" width=\"1004\" height=\"549\" \/><\/a><\/p>\n<p>Now try uploading the file again and you will be able to upload it successfully !!!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>If you own a website where users are allowed to upload files, you might often get complaints stating that they are unable to upload files. They would be hitting an error as follows: &#8220;Error: The uploaded file exceeds the upload_max_filesize directive in php.ini&#8221; upload_max_filesize mentioned in the error above is the limit of the size [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[133],"tags":[41,140],"class_list":["post-673","post","type-post","status-publish","format-standard","hentry","category-php","tag-php","tag-upload_max_filesize"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v23.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to solve the error upload_max_filesize in PHP - Copahost<\/title>\n<meta name=\"description\" content=\"How to solve the error Error: The uploaded file exceeds the upload_max_filesize directive in php.ini . How to increase the PHP upload max filesize option.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to solve the error upload_max_filesize in PHP - Copahost\" \/>\n<meta property=\"og:description\" content=\"How to solve the error Error: The uploaded file exceeds the upload_max_filesize directive in php.ini . How to increase the PHP upload max filesize option.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/\" \/>\n<meta property=\"og:site_name\" content=\"Copahost\" \/>\n<meta property=\"article:published_time\" content=\"2016-06-13T21:14:01+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-05-31T14:13:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php1.jpg\" \/>\n<meta name=\"author\" content=\"Gustavo Bastos\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Gustavo Bastos\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/\"},\"author\":{\"name\":\"Gustavo Bastos\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/79c41e5bdbfb917d1582160330fa0eca\"},\"headline\":\"How to solve the error upload_max_filesize in PHP\",\"datePublished\":\"2016-06-13T21:14:01+00:00\",\"dateModified\":\"2020-05-31T14:13:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/\"},\"wordCount\":397,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php1.jpg\",\"keywords\":[\"php\",\"upload_max_filesize\"],\"articleSection\":[\"PHP\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/\",\"url\":\"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/\",\"name\":\"How to solve the error upload_max_filesize in PHP - Copahost\",\"isPartOf\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php1.jpg\",\"datePublished\":\"2016-06-13T21:14:01+00:00\",\"dateModified\":\"2020-05-31T14:13:20+00:00\",\"description\":\"How to solve the error Error: The uploaded file exceeds the upload_max_filesize directive in php.ini . How to increase the PHP upload max filesize option.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/#primaryimage\",\"url\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php1.jpg\",\"contentUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php1.jpg\",\"width\":1113,\"height\":603},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.copahost.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to solve the error upload_max_filesize in PHP\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#website\",\"url\":\"https:\/\/www.copahost.com\/blog\/\",\"name\":\"Copahost\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.copahost.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#organization\",\"name\":\"Copahost\",\"url\":\"https:\/\/www.copahost.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png\",\"contentUrl\":\"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png\",\"width\":223,\"height\":40,\"caption\":\"Copahost\"},\"image\":{\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/79c41e5bdbfb917d1582160330fa0eca\",\"name\":\"Gustavo Bastos\",\"url\":\"https:\/\/www.copahost.com\/blog\/author\/gbastos\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to solve the error upload_max_filesize in PHP - Copahost","description":"How to solve the error Error: The uploaded file exceeds the upload_max_filesize directive in php.ini . How to increase the PHP upload max filesize option.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/","og_locale":"en_US","og_type":"article","og_title":"How to solve the error upload_max_filesize in PHP - Copahost","og_description":"How to solve the error Error: The uploaded file exceeds the upload_max_filesize directive in php.ini . How to increase the PHP upload max filesize option.","og_url":"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/","og_site_name":"Copahost","article_published_time":"2016-06-13T21:14:01+00:00","article_modified_time":"2020-05-31T14:13:20+00:00","og_image":[{"url":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php1.jpg"}],"author":"Gustavo Bastos","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Gustavo Bastos","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/#article","isPartOf":{"@id":"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/"},"author":{"name":"Gustavo Bastos","@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/79c41e5bdbfb917d1582160330fa0eca"},"headline":"How to solve the error upload_max_filesize in PHP","datePublished":"2016-06-13T21:14:01+00:00","dateModified":"2020-05-31T14:13:20+00:00","mainEntityOfPage":{"@id":"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/"},"wordCount":397,"commentCount":0,"publisher":{"@id":"https:\/\/www.copahost.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/#primaryimage"},"thumbnailUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php1.jpg","keywords":["php","upload_max_filesize"],"articleSection":["PHP"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/","url":"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/","name":"How to solve the error upload_max_filesize in PHP - Copahost","isPartOf":{"@id":"https:\/\/www.copahost.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/#primaryimage"},"image":{"@id":"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/#primaryimage"},"thumbnailUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php1.jpg","datePublished":"2016-06-13T21:14:01+00:00","dateModified":"2020-05-31T14:13:20+00:00","description":"How to solve the error Error: The uploaded file exceeds the upload_max_filesize directive in php.ini . How to increase the PHP upload max filesize option.","breadcrumb":{"@id":"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/#primaryimage","url":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php1.jpg","contentUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/06\/php1.jpg","width":1113,"height":603},{"@type":"BreadcrumbList","@id":"https:\/\/www.copahost.com\/blog\/php-upload-max-filesize\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.copahost.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to solve the error upload_max_filesize in PHP"}]},{"@type":"WebSite","@id":"https:\/\/www.copahost.com\/blog\/#website","url":"https:\/\/www.copahost.com\/blog\/","name":"Copahost","description":"","publisher":{"@id":"https:\/\/www.copahost.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.copahost.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.copahost.com\/blog\/#organization","name":"Copahost","url":"https:\/\/www.copahost.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png","contentUrl":"https:\/\/www.copahost.com\/blog\/wp-content\/uploads\/2016\/03\/copahostlogo.png","width":223,"height":40,"caption":"Copahost"},"image":{"@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.copahost.com\/blog\/#\/schema\/person\/79c41e5bdbfb917d1582160330fa0eca","name":"Gustavo Bastos","url":"https:\/\/www.copahost.com\/blog\/author\/gbastos\/"}]}},"_links":{"self":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts\/673","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/comments?post=673"}],"version-history":[{"count":8,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts\/673\/revisions"}],"predecessor-version":[{"id":687,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/posts\/673\/revisions\/687"}],"wp:attachment":[{"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/media?parent=673"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/categories?post=673"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.copahost.com\/blog\/wp-json\/wp\/v2\/tags?post=673"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}