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. Manish says

    I am unable to import my blogger exported xml file to wordpress.
    My blogger imported xml file size is 24 mb.
    Please solve this problem, i shall be thankful to you.

  3. John says

    Has anyone ever told you that the copy and paste YOUR code all throughout your site always has the:

    1: code
    2: code
    3: code

    So it’s a bit of a edit to get it to work right when a simple copy/paste would be stressfree for your readers! Just sayin…

    • Michael Kelley says

      Thanks! This is the only thing that worked for me. Worth noting, I already had a php5.ini file in there w/ the same code, it did nothing. A tad confusing.

  4. Robert says

    After 2 hours of frustration, the htaccess method mentioned here worked out for my local environment.

    Thank you very much. :)

  5. Robin says

    I change my .htaccess and put

    php_value memory_limit 2G
    php_value upload_max_filesize 2G
    php_value post_max_size 2G
    php_value max_execution_time 99999
    php_value max_input_time 99999

    when I go for upload a fine it shows 2GB but when I upload any file that larger then 128MB it shows HTTP error. Need help please.

    Thanks

  6. Robin says

    I add on my .htaccess

    php_value memory_limit 2G
    php_value upload_max_filesize 2G
    php_value post_max_size 2G
    php_value max_execution_time 99999
    php_value max_input_time 99999

    and it shows 2GB but when I upload larger then 128M file it gives me HTTP error. can anyone help me please.

    Thanks

  7. Elisabeth Parker says

    I DO NOT recommend putting that code in the Theme Functions file. I tried it and it completely blew up my site. And if you don’t know how to use FTP or the File manager to change the Functions file BACK, you’ll be very unhappy. I haven’t tried the other options but if I find something that works I’ll let you know :)

    • kennedy Odhiambo says

      Hello Elisabeth,ive tried it and it has also blown up my site,i cant acces it…may i please know how you fixed it?

  8. Caki says

    Just contacted godaddy. I am using cpanel hosting through them. He added a file .user.ini in the public/html file with the following:

    memory_limit = 128M
    max_execution_time = 300
    post_max_size = 128M
    upload_max_filesize = 256M

  9. Craig says

    in the .htaccess solution, where in the file do you enter the code, i put it at the end and got a 500 error?

  10. Cornelius says

    I heard as an alternative you could just directly upload via the ftp cpanel, but when I do that the PDF does not show up in my WP media dashboard?

    • WPBeginner Support says

      Hi Cornelius,

      You can upload a PDF file but yes you are right it will not be visible in the Media library on your WordPress site. To see a file in the media library and be able to easily add it, you would need to upload it using the built in media uploader.

      管理者

      • Christopher Eller says

        You can upload anything via FTP/SFTP and then add it to the database using a plugin like Add From Server.

  11. Nitus says

    This worked for me (as nothing else would):

    – Open wp-config.php
    – At the very bottom add this line:

    define(‘WP_MEMORY_LIMIT’, ‘128M’);

    – Save (and upload your file)

  12. Maja says

    So i’m not a developer so i dont feel like messing with php and some functional stuff.
    i found from a post above php settings and all is set right, max file size is 30MB so i’m confused why i still can’t upload media bigger than 5mb.
    is there a wordpress thing that i’m missing
    i didn’t find anywhere place to change that,

  13. Niall Flynn says

    If you are using cPanel most of the time you edit via the PHP Version settings, you can check if you are on 5.6 or 7.0 and edit all the settings via cpanel. For me this is the only way my host has all the others locked down, but its real handy and there are simple ways to enable PHP modules and tweak any setting.

  14. yaser says

    Thanks.

    This is what finally worked for me:

    In wp-config, before wp-settings:

    define( ‘WP_MEMORY_LIMIT’, ‘256M’ );
    define( ‘WP_MAX_MEMORY_LIMIT’, ‘256M’ );
    ini_set( ‘memory_limit’, ‘256M’ );

    In .htaccess:

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

  15. Sean says

    Hello

    I am building a woocommerce store for selling audio files. Some of my files are over 100MB so uploading straight from wordpress wont work. What I am trying to do is Upload the file to cpanel and than post that link in the downloadable product on WP. But I dont know how to do it. I view the file in cpanel and copy that link but that just takes the person to cpanel login. I dont know hot to get the link of my file in cpanel so others can download it when they buy a product?

    Do you have a tutorial on this?

    or can you help?

    Thanks

    • Ian says

      You would need to look more into this because you would need security for that file url, generally the file url is accessible to everything and therefore can be downloaded without making a purchase.

  16. john says

    Absolutely DO NOT try to enter that code into the Theme Functions file!!!!! Now I am getting error messages and can’t get to the dashboard for my site. I won’t DARE try any of their other suggestions.

  17. Fred Preston says

    Thanks. the .htaccess version worked for me. I just had to remember to show hidden files in my cpanel file manager.

  18. John says

    Just wanted to say thanks. I’ve been able to solve three wordpress related issues in one day, all with help from this website. Kudos on the good work. :D

  19. David says

    Thanks.
    The php.ini edits helped. I had to make sure to also up the post_max size as well. I failed to edit this on first update, and nothing changed. Edit all parameters and presto. Thanks again!

  20. Aswani Somarajan says

    It was great. Very helpful! Had to upload a theme, used the second method. added a ner php.ini file and the theme is installed. Thanks a lot :)

  21. John says

    Thanks for helping

    making the changes in the .htaccess method made the website crash
    however changing the php.ini file worked for me.

  22. Don says

    or try another method like mine,

    on cpanel > click the “select php version” > then click “switch to php options” > find the “upload_max_filesize” then change it whatever you want.

  23. bob hildegard says

    ‘upload_max_size’ is not a php.ini variable name. it’s ‘upload_max_filesize’. that’s stated wrong in solution 1

  24. Trevor says

    I tried your first suggestion, and apparently threw some bad code into the functions.php file and now I have lost access to my website’s dashboard, the actual website cannot be accessed by anyone, and the problem is obviously not solved.

  25. Okie Wardoyo says

    Hi, where i should put that code to my .htaccess file.
    I have tried put this code to my htaccess file but it always 500 internal server error when i open my live site.

    # BEGIN WordPress

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

    php_value max_input_vars 5000
    php_value max_execution_time 300
    php_value post_max_size 50M

    # END WordPress

    • John Jones says

      Try this:

      php_value upload_max_filesize 50M
      php_value post_max_size 50M
      php_value max_execution_time 300
      php_value max_input_time 300

  26. Manas Mitra says

    Hi,

    I have used the first method of adding code to child theme functions.php file, but it does not have the desired effect. In localhost, the limit is 3 MB and in shared server, the limit is 32 MB. Any idea why it is happening so?

    Thanks.

  27. cathy belyea says

    i have followed this even contacted my host increased my uploads to 64mb however in wordpress it still only allows 8mb.
    any other suggestions please help.

  28. Guillermo says

    Same problem for wordpress 3.9 / 4 version and having a look to Chrome console or firefox I saw an error 413 of NGINX when uploading

    Maybe this thread can help to nginx users ;)

返信を残す

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