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. Mouad Chafai says

    Thanks php.ini method worked perfectly.

    i’ve created the php.ini :)
    wp-adminphp.ini
    add lines:

    upload_max_filesize = 64M
    post_max_size = 64M
    max_execution_time = 300

    thanks for the article.

  3. Ben Peacock says

    Sorry please find this instead Login to the root machine type the following command nano /usr/lib/php.ini

    find ; Maximum size of POST data that PHP will accept.
    post_max_size = 2M change this to 64

    Save and exit and then you should be able to upload what you need hope this helps :)

  4. Maria McCarthy says

    Adding the php.ini file to my wp-admin folder SPECIFICALLY worked for me as well! Thanks everyone! Only took me almost 4 hours to find a page that had the info which would work for me – lifesavers!

  5. Mike says

    with some host ( godaddy ) for example, there may be some additional steps.

    And to what php you are running. For godaddy with php5, rename php.ini to php5.ini and remember if you have accuracies running, you will have to temp. end them before the file will even take over, or wait awhile for it.

    System Processes / End all

  6. jaymz says

    Many thanks for the article. For self-hosted there’s another way as methods 2 and 3 didn’t work for me as the .htaccess change had no effect and neither did adding a php.ini file in /wp-admin. It was simply a case of finding the existing php.ini file for Apache. On Ubuntu I ran;

    sudo find / -name php.ini

    This found my ini file in /etc/php5/apache2/
    All that was needed was to locate the parameters and update the values for;
    upload_max_filesize
    post_max_size
    max_execution_time

    Thanks for getting me there!

  7. D Winzell says

    Thanks for writing this. The php.ini does need to be in the wp-admin directory to function correctly. Just checked my host (Vaurent) and they allows up to 105M file uploads so I am going to find something that size and see if it makes it’s merry way up to my blog.

  8. Matt says

    I just want to add, using godaddy you cannot use the htaccess method, it will throw you into a 500 internal service error.

    You must use the php.ini method. Only difference will be you have to have a php.ini and a php5.ini and the lines must be added to both. The files need to be in the root directory of where the wordpress install is, not in the wp-admin folder, outside of it.

    Also if you have multiple wordpress installations This has to be done and placed into each directory that each wordpress installation is located.

  9. sandeep says

    php_value upload_max_filesize 64M
    php_value post_max_size 64M
    php_value max_execution_time 1500
    php_value max_input_time 1500

    i use these values in .htaccess and it works !

    thanks

  10. Thyme says

    So I did all of those and changed the php.ini in the /etc folder (my site is on mediatemple’s grid-service) and nothing was working but then I vaguely remembered there was something I had to change in the network settings if my installation was multisite and there it was. Ugh.

    So yeah, if you’ve got a WordPress network, go to your network settings and change the max file size upload near the bottom of the page.

  11. Alex says

    This is the only thing that worked for me, I tried all the options, I’m on 1&1

    memory_limit = 32M
    upload_max_filesize = 32M
    post_max_size = 32M
    file_uploads = On

    ** Size can be anything

    The key was the “file_uploads” line

    Place this in the /wp-admin/ folder.

  12. Bogdan says

    Great advice. My upload limit was 8MB and I only tried the htaccess trick and it worked, it increased to 64MB. I tested it and it is owrking beautiful! Thank you so much for your great advice!

  13. VoidnessMD says

    Important thing to note: Using the php.ini method requires that the file be located in the wp-admin folder, not the root of your WP installation.

  14. mostafa says

    hi.
    i successfully did it with the third method. my upload size was 8 M, but now its 64 M. for me its more than enough.

    Thanks a million.
    by the way i’m from Iran.

  15. Rowan Evenstar says

    The creating a php.ini file and popping it on the route sorted it straight away!
    Cheers, much appreciated!

  16. assassinateur says

    thnx, but i am in a shared hosting so nothing work, i did put the php.ini in wp-admin and in the blog folder and in the homefolder and dodnt work also .htaccess didnt work changed the theme and didnt work

  17. Arvind Kukreti says

    Adding code in .htaccess file might throw you 500 Internal Error… the best way is create a php.ini file and upload it in wp-admin folder

    • Stephen Afije says

      Waooo that was brilliant one there all i did was to create php.ini and uploaded to the wp-admin folder it worked like no other thing thanks

  18. Andrew Lilly says

    Hi,

    I have done all of the above and still wont let me import an 11mb xml file. i need it as its got 1500 products on i need to import.

    I have spoken to my virtual server provider 1and1 and they said all i need to do is add the code to the .htaccess file but it doesnt seem to work

    Please someone help

  19. Makarand Mane says

    I have hosting on mediatemple. First two methods are not worked me. Only htaccess methos is worked for me.

    Thanks.

  20. Gavin says

    I found that php.ini was hidden in the cgi-bin folder which some shared servers have in their root directories. I amended this as above (AND added a php5.ini jut in case) but until I’d amended this, nothing else worked. Thanks for the VERY useful thread!

    • Cath says

      Thanks Gavin, none of the other methods worked for me then I saw your comment, there were php.ini and php4.ini files were in the cgi-bin folder. I found the relevant code in both files – post_max_size = , and upload_max_filesize = , amended these and now all works fine.

  21. Anthony says

    The only thing that worked for me was to create/edit a php.ini file and add the following:
     
    memory_limit = 100M upload_max_filesize = 100M post_max_size = 100M file_uploads = On
     
    and uploading it to the wp-admin folder.
     

  22. kat1111 says

    I am evidently newer than most here, I don’t understand which is “root” directory, is it Editor under the Appearance tab? Also, I don’t undertand how to get to hcaccess. Any help is appreciated.

  23. Snipsley says

    Thanks, but neither of this worked for me.

    But I found the solution!
    I had to place that php.ini to /public_html AND /public_html/wp-admin and it works!

返信を残す

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