Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPBカップ
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

WordPressでファイルの最大アップロードサイズを増やす方法

読者から、ファイルアップロードの制限に関する問題を解決したいとの相談をよく受けます。この単純なサイト設定は、あなたのサイトに予期せぬ影響を与える可能性があります。

例えば、ファイルアップロードサイズの制限が低いと、メディアアップローダーでファイルをアップロードできなかったり、大きなWordPressプラグインやテーマをインストールできなかったりすることがあります。特に制限を変更する方法が本当に〜してもよいですか?

この投稿では、WordPressの最大ファイルアップロードサイズを簡単に大きくして、これらの問題を解決する方法を紹介します。

How to increase the maximum file upload size in WordPress

なぜWordPressの最大ファイルアップロードサイズを大きくするのか?

WordPressホスティングサービスプロバイダは、サインアップしてWordPressをインストールするときに、初期設定の最大ファイルアップロードサイズを設定します。ホスティングサービスはこの制限を定義し、通常2MBから500MBの範囲です。

ほとんどのWordPressサイトオーナーにとって、この制限は十分すぎるほどでしょう。

しかし、アップロードエラーを起こさないために、この制限を引き上げる必要がある場合もあります。

例えば、こうだ:

  • 写真サイトを運営していて、大きな画像をアップロードする必要がある。
  • あなたのデザインや写真のポートフォリオには大きな画像があります。
  • より大きなWordPressテーマやプラグインをインストールしたい。
  • eBook、写真、動画などのデジタル製品を販売したい。
  • あなたは定期的にコンテンツを更新し、音声や写真など、現在の制限を超えるものを追加する。

それでは、WordPressサイトの最大ファイルアップロードサイズを増やす方法をご紹介しましょう。

:サイトに大きなファイルをたくさん表示すると、サイトのスピードやパフォーマンスが著しく低下する可能性があることに留意してください。WordPressに動画をアップロードしないことをお勧めするのはそのためです。

ほとんどのユーザーは異なるWordPressホスティングサービスを設定しているため、ここでは以下を取り上げます:

動画チュートリアル

Subscribe to WPBeginner

もし、文章での説明がお望みなら、このまま読み進めてほしい。

WordPressの最大アップロードサイズを確認する方法

WordPressは、画像やその他のメディアをアップロードする際に、ファイルアップロードサイズの上限を自動的に表示します。

これを確認するには、WordPress管理画面のメディア ” 新規追加にアクセスするだけで、WordPressサイトの最大ファイルアップロードサイズ制限が表示されます。

Check current file upload size limit

サイズ制限の見つけ方がわかったところで、WordPressの最大アップロードサイズを増やす方法を紹介しよう。

方法1:WordPressホスティングサービスプロバイダーに問い合わせる

WordPressの最大ファイルアップロードサイズを増やす最も簡単な方法の1つは、WordPressホスティングサービスプロバイダーに連絡することです。

これはカスタマー・サービス・チームにとっては比較的簡単な作業で、数分で完了する。

初心者にとっては、WordPressにコードを追加したり、サーバーファイルを編集したりするよりもはるかに簡単です。

Bluehostのようなホスティングサービスのサイトにアクセスしてログインするだけです。

次に、画面下部の「チャット」アイコンをクリックします。その後、WordPressサイトのファイルアップロードサイズを増やすようサポートスタッフに依頼することができます。

Clicking the Bluehost live chat support button in the dashboard

また、ホスティングアカウントのダッシュボードからサポートに連絡することもできます。

方法2:既存のphp.iniファイルを作成または編集する

最大ファイルアップロードサイズを増やすもう一つの方法は、php.iniと呼ばれるファイルを作成または編集することです。このファイルは、WordPressホスティングサービス環境の多くの設定をコントロールします。

BluehostのようなほとんどのWordPressホスティングサービスは、あなたのウェブサイトを管理するのに役立つ初心者に優しいcPanelを持っています。

ホスティングサービスにcPanelダッシュボードがある場合は、ビルトインツールを使用してファイルアップロードサイズを増やすことができます。

注:以下はBluehostのcPanelからです。しかし、ほとんどの共有ホスティングサービスプロバイダーは、同様の手順があります。

Bluehostのホスティングサービスタブの下部にcPanelボタンがあります。

Open cPanel in Bluehost

このボタンをクリックすると、cPanelのダッシュボードが開きます。

ソフトウェア」セクションまでスクロールし、「MultiPHP INIエディター」をクリックしてください。

MuliPHP INI Editor in Bluehost's cPanel

次に、「upload_max_filesize」と書かれたセクションまでスクロールダウンし、新しい最大ファイルサイズをボックスに入力する。

そして「Apply」ボタンをクリックする。

Upload Max Filesize Setting

または、「エディターモード」メニュータブをクリックし、エディター内で直接最大アップロードサイズを変更することもできます。

アップロードサイズを増やすには、’upload_max_filesize’セクションを編集する必要があります。

完了したら、「保存」ボタンをクリックします。

Change max upload filesize in code editor

コードを追加してphp.iniを編集する

現在のホスティングサービスがcPanelオプションを提供していない場合は、手動でこのファイルを編集する必要があります。

これを行うには、FTPクライアントまたはWordPressホスティングコントロールパネルのファイルマネージャーオプションを使用することができます。

共有ホスティングサービスを使用している場合、ホスティングディレクトリにphp.iniファイルが表示されないことがあります。php.iniが表示されない場合は、php.iniという名前のファイルを作成し、ルートフォルダーにアップロードしてください。

次に、以下のコード・スニペットをファイルに追加する:

upload_max_filesize = 256M
post_max_size = 256M
max_execution_time = 300

256M」の制限は、WordPressブログに必要なファイルサイズに変更することができます。

方法3:WordPressテーマのfunctions.phpファイルにコードを追加する

この方法では、WordPressテーマのfunctions.phpファイルにコードを追加します。

ファイルを直接編集する代わりに、WPCodeの使用をお勧めします。サイトを壊すことなくコードを追加できる、最高のコードスニペットプラグインです。

WordPressでカスタムコードを追加する方法については、初心者向けガイドをご覧ください。

まず、無料のWPCodeプラグインをインストールする必要があります。詳しくは、WordPressプラグインのインストール方法のステップバイステップガイドをご覧ください。

有効化したら、コードスニペット ” + スニペットを追加” に移動してください。Add Your Custom Code」オプションにマウスオーバーし、「Use snippet」ボタンをクリックします。

Add a Custom Snippet in WPCode

次の画面で、新規スニペットに名前を付け、コードタイプを「PHP Snippet」に変更します。

次に、以下のコード・スニペットを「コード・プレビュー」にコピー&ペーストしてください。256M」を必要な最大ファイルサイズに変更してください:

@ini_set( 'upload_max_size' , '256M' );
@ini_set( 'post_max_size', '256M');
@ini_set( 'max_execution_time', '300' );
Save Your Custom Snippet in WPCode

最後に、上部のトグルを「有効化」に切り替え、「スニペットを保存」ボタンをクリックします。これでサイト上でコードが実行されます。

方法4:.htaccessファイルにコードを追加する

最大ファイルサイズを増やすもう一つの方法は、.htaccessファイルを変更することです。このファイルは、サイトのハイレベルなコンフィギュレーション設定をコントロールします。

これを行うには、FTPでサイトサーバーにログインする必要があります。FTPを使用したことがない場合は、初心者向けのFTPを使用してWordPressにファイルをアップロードする方法のガイドを参照してください。

その後、.htaccessファイルをサイトのルート・フォルダーに置く必要があります。

Open .htaccess file

.htaccessファイルが見つからない場合、ファイルマネージャーやFTPクライアントによって非表示になっている可能性があります。さらに詳しく知りたい方は、WordPressサイトの.htaccessファイルが見つからない理由についてのガイドをご覧ください。

次に、以下のコード・スニペットを.htaccessファイルに追加する必要がある:

php_value upload_max_filesize 256M
php_value post_max_size 256M
php_value max_execution_time 300
php_value max_input_time 300

最大アップロードサイズをさらに大きくするには、「64M」を必須サイズに変更するだけです。

方法5:WordPressのプラグインを使ってファイルのアップロードサイズを大きくする

ファイルアップロードの上限を増やすもう一つの方法は、WP Increase Upload Filesizeプラグインを使うことです。WordPressにコードを追加することに抵抗がある場合は、このプラグインを使用するのも良い設定です。

最初に行う必要があるのは、プラグインのインストールと有効化です。詳しくは、WordPressプラグインのインストール方法をご覧ください。

有効化したら、WordPress管理画面のメディア ” アップロードリミットを増やすに移動します。

これにより、「最大アップロードファイルサイズの選択」ドロップダウンで新しいファイルアップロードサイズを選択できる画面が表示されます。

その後、「変更を保存」ボタンをクリックします。

Increase file upload size with plugin

注:ファイルの最大アップロードサイズは、ホスティングサービスプロバイダによって設定されます。ドロップダウンに表示されているサイズよりも大きなファイルサイズの制限が必要な場合は、ホスティングサービスに連絡して、制限を増やすように依頼する必要があります。

この投稿がWordPressの最大ファイルアップロードサイズを増やすのにお役に立てば幸いです。また、最高のサイトビルダーの選び方や、専門家が選ぶ無料オプション付きの最高のバーチャルビジネス電話番号アプリもご覧ください。

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

情報開示 私たちのコンテンツは読者支援型です。これは、あなたが私たちのリンクの一部をクリックした場合、私たちはコミッションを得ることができることを意味します。 WPBeginnerの資金源 をご覧ください。3$編集プロセスをご覧ください。

アバター

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

究極のWordPressツールキット

ツールキットへの無料アクセス - すべてのプロフェッショナルが持つべきWordPress関連製品とリソースのコレクション!

Reader Interactions

406件のコメント返信を残す

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Alexander Gartley says

    Thanks, this helped me troubleshoot an upload limit. I’m on a WordPress multisite network install, so it ended up being a setting in the Network Admin Settings.

    I was confused at first, because my php settings were allowing larger uploads, but it was restricted in the Network Settings.

  3. Ernesto says

    Would have been great if you have included the .user.ini method.

    .user.ini uploaded in the root folder with the same value/text in your edited php.ini

    Most of the time, only this method works for shared hosting.

    ErnestPH

    • WPBeginner Support says

      The php.ini file should work the same as the user.ini file unless your specific host ignores the php.ini but thank you for sharing your recommendation :)

      管理者

  4. Tamir Davidoff says

    Not working for me.
    I have followed this guide and double checked the php.ini file to make sure that the changed are in fact saved. changed htaccess file to increase limits. and also tried modifying the phpMyAdmin httpd-app.conf and php-settings.conf file. All of these files reflect max upload higher than 40m and my WP site does not reflect Any of these changes. Really frustrated here.

    Please help me, thanks !

    • WPBeginner Support says

      If you haven’t already, you would want to reach out to your hosting provider to ensure there is not a setting on their end that is overriding what you are setting :)

      管理者

  5. rajesh says

    i have tried all 3 method none of them worked. i am trying to upload newspaper theme in my in my wordpress site. but every time it show that php.ini file upload max file size.
    plz help me

    • WPBeginner Support says

      You would want to reach out to your hosting provider to ensure they don’t have a setting that is overriding the changes you made.

      管理者

  6. Adam Walsworth says

    Watchout for hidden php.ini files. In my setup I found 2 of them. The one which I found actually resolved the issue was found under

    ./etc/php/7.0/apache2/php.ini

    modifying this file fixed my issue.

    • WPBeginner Support says

      Thanks for sharing your solution, with where that file is located we would recommend most users reach out to their hosting provider before looking in locations like that.

      管理者

  7. Rafiq khan says

    Thanks buddy i have solved my problem by adopting method 2 by editing my php.ini file
    Thanks alot you are working great

  8. Carla says

    None of the above worked for me. A matter of fact, editing the htaccess file broke my site even after deleting the above code. Overwriting with a new file fixed the problem though.

    I have a dedicated server on Bluehost. What worked for me was going in the WHM root, not cpanel nor FTP access. Search for MultiPHP INI Editor. Give it at least 5 minutes to load if you only see the title and icon. You can set you upload time, post size, etc. there. Works instantly, even if your site is using Cloudflare, without placing it in development mode or clearing the cache. I hope this helps someone.

    • WPBeginner Support says

      Thank you for sharing what worked for you, should other users be on a dedicated server, if they reach out and let BlueHost know the need to increase the upload size then BlueHost can normally edit that for them :)

      管理者

  9. rahul says

    when i tried this
    Unable to communicate back with site to check for fatal errors, so the PHP change was reverted. You will need to upload your PHP file change by some other means, such as by using SFTP.
    this happened to me
    whats the solution of this

  10. Ephraim says

    I had been trying php.ini method but it never works please how will I set it..
    Or you should please tell me the were to paste at function.php

    • WPBeginner Support says

      You would normally use a text editor to set the content in the php.ini file. For your functions.php it should go at the end normally so it can be removed later as needed. You may also want to check with your hosting provider if you are having trouble with these methods for if they can assist in increasing the file size for you.

      管理者

  11. Ivos G. says

    None worked for me. But this one fixed it – add to your .htaccess this line:

    LimitRequestBody 104857600

  12. Achilleas says

    I am using Nginx and i had already setup properly the values for php in the php.ini but what fixed it was puting the same value in the server block with the variable client_max_body_size xxxM;

    I am writing this hoping it will help someone.

  13. Adriana Sabo says

    None of the options worked for me. Nothing happened when I tried the first two, and the last one prompted an error 500. Any way you can help?

  14. Tom Allen says

    The above explanation is fine for hosted sites, bit what about us guys that locahost? I still can figure out the “upload_max_filesize” error when downloading Updfaftplus from WP Plugins or from a download zip file. I am a beginner and need hand-holding through this process. Help is appreciated.

  15. crystal says

    hta access worked.
    you guys must put the code before #END WordPress
    if you put after #end wordpress then site goes to 500 internal server error in my experience with godaddy hosting

  16. Jaime Lopes says

    On most of the shared cPanel sites I’ve setup:

    -changing .htaccess brings the whole site down (500 internal error)
    -adding php.ini or php5.ini files does nothing
    -there is no option to choose ‘Site Software’ in cPanel…

  17. Megan says

    Thank you! This was a huge help! I couldn’t even upload plugins because my limit was pre-set at 2MB…Now I’ve got it to 64MB and am able to work.
    Thanks!

  18. Martin Croker says

    On vidahost (now TSOhost).

    Adding the following php.ini worked for me… however (and I’m still a bit confused why), just putting it at http root didn’t work – I had to duplicate the php.ini file inside wp-admin and wp-include directories within wordpress.

  19. Dwayne S says

    I’m on HostGator and currently having issue with max execution time. It occurred a few weeks ago and HostGator support fixed the issue. It now reappeared and support is telling me that they can’t fix it because I’m on shared server. The agent even crashed my site by manually editing the htaccess file and didn’t verify if it was working or not. He did however recommend a plugin that would edit the htaccess file with code to increase the limit but it doesn’t work. I guess HostGator blocks it

  20. Jessany says

    I added the code into the .php functions folder, and now WordPress will not load. How do I fix this problem??

  21. Caleb says

    I have GoDaddy hosting and contacted them to help me increase my file upload size. It was a piece of cake — I didn’t have to create any files, add code to my theme, or anything like that. So for those of you who have GoDaddy or cPanel type controls, forget hacks and just use your admin settings.

    Here’s what support had me do:
    1. Go to your cPanel Admin (a similar hosting panel ‘might’ work somewhat the same)
    2. Scroll down to the ‘Software’ and click on ‘Select PHP Version’
    3. Click on ‘Switch to PHP Options’ in the top right And TADA! There’s all your PHP Options!
    4. Just go down and change the ‘post_max_filesize’ and ‘upload_max_filesize’ to whatever you want, apply and save your changes, and you’re now a safe and happy non-coding website owner.

    Good luck!

    • Rich Perozich says

      This worked for me but in order to even find these files, I had to call godaddy where I was walked through these steps or I never would have been able to navigate to the cpanel Admin without their help.
      1. Sign on to godaddy
      2. Click on my products upper left
      3. Under web hosting click manage all
      4. Click web hosting with C panel
      5. Click C panel Admin icon
      6. Scroll down to Software and click Select php version
      7. Click on switch to php options
      8. At bottom of page click on the number upload_max_filesize and select # you wish as the max filesize
      9. Click apply. It works. Now file sizes can be uploaded to the selected max.

  22. Chris Sandford says

    Multisite Users:
    If your a dumb dumb like me, you may have tried everything to no avail.
    Don’t forget if you’re using WordPress Multi-site, to change the upload settings for individual sites.
    Network Admin > Settings > Max upload file size

    You may still need to use the tips in this article, but without changing the upload settings for multi-site, you won’t know if it’s working.

  23. mara says

    Anyone on here get this to work with Godaddy? There are very unhelpful. I know I need to create the php.ini file, (and I did), but none of the solutions you posted worked. Any help is appreciated.

  24. Lynn says

    Wish you wouldn’t assume everyone looking for this solution knows what you mean by our “Theme Functions File” – do you mean functions.php? I’m not an expert, and I’m really good at following precise directions, and don’t want to even put a toe in the water of editing files if I don’t know EXACTLY what file you’re talking about! No clues were provided, like what other code I might look for in the file to know I’m in the right place, etc. So…this didn’t help me at all :-(

  25. Alex says

    Thank you, method 3 really worked for me
    php_value upload_max_filesize 64M
    php_value post_max_size 64M
    php_value max_execution_time 300
    php_value max_input_time 300

  26. Mituka says

    This worked for me.

    Open your .htacess file with notepad.

    Skip everything you see and at the bottom.

    Paste the following and save.

    php_value upload_max_filesize 64M
    php_value post_max_size 64M
    php_value max_execution_time 300
    php_value max_input_time 300

    • Thomas says

      Where exactly did you paste it?

      # BEGIN WordPress

      RewriteEngine On
      RewriteBase /
      RewriteRule ^index\.php$ – [L]
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule . /index.php [L]

      # END WordPress

      php_value upload_max_filesize 64M
      php_value post_max_size 64M
      php_value max_execution_time 300
      php_value max_input_time 300

      Is it before the #END WordPress statement? ( I get error when I do that)

      Or should it be after the #END WordPress statement?

返信を残す

コメントありがとうございます。すべてのコメントは私たちのコメントポリシーに従ってモデレートされ、あなたのメールアドレスが公開されることはありませんのでご留意ください。名前欄にキーワードを使用しないでください。個人的で有意義な会話をしましょう。