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でファイルの最大アップロードサイズを増やす方法

編集メモ: WPBeginner のパートナーリンクから手数料を得ています。手数料は編集者の意見や評価に影響を与えません。編集プロセスについて詳しく知る。

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

例えば、ファイルアップロードサイズの制限が低いと、メディアアップローダーでファイルをアップロードできなかったり、大きな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$編集プロセスをご覧ください。

Avatar

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. Ray Konopka says

    Thanks for the tips. My site is hosted in BlueHost so I first tried Method 2. However, after changing the upload_max_filesize value, the Add New media page for my site still showed 64 MB. I went back into the MultiPHP INI Editor and looked at the other values. One other value stood out:
    post_max_size
    Sets max size of post data allowed. This setting also affects file upload. To upload large files, this value must be larger than upload_max_filesize. Generally speaking, memory_limit should be larger than post_max_size.

    After I increased the post_max_size value as well, then the Add New media upload page showed the new limit. Perhaps you can update the post to include this tip.

    • WPBeginner Support says

      Thank you for sharing this, we’ll be sure to look into it and possibly add it to the article in the future :)

      管理者

  3. Mark says

    All my limits were increased as suggested, but I started getting ‘files are too big’ after a plugin update. After double checking everything server and email side, the solution was changing from 5M to 5120kb in Contact Form 7 settings. The plugin suddenly stopped recognizing M when trying to override the default 1024kb setting.

    • WPBeginner Support says

      It would depend on your host and what else is set up on your server for what will work. If nothing else works you can always reach out to your host for assistance.

      管理者

  4. Muhammad Farooqi says

    You comments and thanks secion is almost 10 times longer..than the content of this page is guarantee of your amazing tips

    • WPBeginner Support says

      If the recommendations are not working for you, we would recommend reaching out to your hosting provider and they should be able to assist if this is something they’ve set on their end.

      管理者

  5. Abdullah Ashraf says

    Thank you so much. I tried all the methods and the last method was helpful for me.
    I would like to know should I undo the second last step that was php.ini?

    • WPBeginner Support says

      It is not required to remove that file but you can remove it if it is not working for your server.

      管理者

    • WPBeginner Support says

      If none of our recommendations work, we would recommend reaching out to your hosting provider to see if it is a restriction that they have set on their servers.

      管理者

  6. Ben says

    If you have access to the FTP, can I just upload the file in the wp-content/uploads/[year]/[month] folder?

    • WPBeginner Support says

      It would depend on the method you are using but it could help with restoring a backup that large.

      管理者

    • WPBeginner Support says

      If none of the recommendations worked we would recommend reaching out to your hosting provider for assistance.

      管理者

  7. Ahmad says

    I tried this but the size did not change… status is same please help what should I do know I am using localhost

    • WPBeginner Support says

      You would want to try restarting your localhost service just in case, otherwise, you would want to ensure you added/editied the php.ini correctly for the most common reason.

      管理者

  8. Vittorio says

    I think
    @ini_set( ‘upload_max_size’ , ’64M’ );

    should be
    @ini_set( ‘upload_max_filesize’ , ’64M’ );

    • WPBeginner Support says

      upload_max_size currently increases that value as well as a few other things which is why we don’t use upload_max_filesize

      管理者

  9. Oliver says

    IT WORKS!!! THANKS

    I made a file ini.php then uploaded it, then renamed it from ini.php.txt to ini.php and it worked.

    thanks

    • WPBeginner Support says

      If our recommendations do not work you would want to reach out to your hosting provider to ensure they do not have it as part of their settings.

      管理者

  10. Asad says

    How can i increase the upload limit while i have the wordpress hosting also functions.php isn’t updating

    • WPBeginner Support says

      If the file will not update, you would want to reach out to your hosting provider and they should be able to assist

      管理者

  11. Chris says

    I want to increase the limit to 250mb but i dont know if this exposes my site to security treats, though am only using gravity form and I have also set to disable php execution on my upload folder. And have allowed only jpg, and mp3 files.
    Please do you think this may affect my site load times as huge upload is coming from several users?

    • WPBeginner Support says

      If multiple users attempt uploads at the same time it can have an effect on your site’s load time but it shouldn’t open you to security threats

      管理者

  12. Janice says

    Nice article, but I tried adding your 3 lines of code to the functions.php file, but got an “unknown @ rule” error. What’s that all about?

  13. 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.

  14. 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 :)

      管理者

  15. 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 :)

      管理者

  16. 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.

      管理者

  17. 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.

      管理者

  18. 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

  19. 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 :)

      管理者

  20. 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

  21. 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.

      管理者

  22. Ivos G. says

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

    LimitRequestBody 104857600

  23. 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.

返信を残す

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