The file you are trying to upload might be too large.

I get this message after updating H5P 1.7.3 to 1.7.12 on Wordpress 4.64 when I try to add audio or image through H5P.

How can I fix it to let me upload content ? 

Please Help :) 

icc's picture

This is a generic error displayed when a file upload fails.

1. Please verify through phpinfo() (or similar) that upload_max_filesize is larger than the file you're trying to upload. Also, ensure that post_max_size is larger than upload_max_filesize and that your web server doesn't restrict the size of the request, e.g. through client_max_body_size or similar.

2. Check both your browser console for any error messages(Ctrl+Shift+J in Chrome – must be opened before uploading) and your web server's error_log file.

3. Check that your web server has write access to the files or data folder it uses for uploads.

1. post_max_filesize is equal to  upload_max_filesize  and is 10M, the files I'm uploading does not exceed this limit.

2. I get this in console view:

SyntaxError: Unexpected token < in JSON at position 0

    at JSON.parse (<anonymous>)

    at HTMLIFrameElement.processResponse (h5peditor-file-uploader.js?ver=1.7.12:212)

    at HTMLIFrameElement.dispatch (jquery.js?ver=1.7.12:2)

    at HTMLIFrameElement.v.handle (jquery.js?ver=1.7.12:2)

I get this in error_log 

[Wed Mar 08 15:37:34 2017] [warn] [client ---] mod_fcgid: stderr: WordPress database error Table 'weblnm.wp_h5p_tmpfiles' doesn't exist for query SHOW FULL COLUMNS FROM `wp_h5p_tmpfiles` made by do_action('wp_ajax_h5p_files'), call_user_func_array, H5PContentAdmin->ajax_files

3. Which folders and what rights they must have?

Wordpress and other plugins allows me to upload. 

Thank You

icc's picture

Ah ok, then there's something wrong with the data returned by the server and it's probably not related to upload_max_filesize. Do you see any messages in the web server's error_log file?

You could try opening the Network tab from the Console to see details for the request that is failing. It would be nice to know what the Response says. 

The server error_log record is posted in my previous post.

And about network tab - I don't see errors, jus errors in Console.

Can You please tell what should I look for in Network Tab ? 

I've attached the image file of view from Network Tab

Attachments: 
icc's picture

Sorry, I missed it.

It seems you're missing one of the database tables, so that means something must have gone wrong during the update. What database software are you using?

The easiest way to fix this is just to create the table manually, you can do so by running the following query in your database admin tool:

CREATE TABLE wp_h5p_tmpfiles (
  id INT UNSIGNED NOT NULL AUTO_INCREMENT,
  path VARCHAR(255) NOT NULL,
  created_at INT UNSIGNED NOT NULL,
  PRIMARY KEY  (id),
  KEY created_at (created_at)
);

After doing so, uploading files should work.

I'm using MySQL , phpmyadmin interface.

I have hp5 in drupal - Opigno (LMS) and had the table missing as well, adding it fixed it!

PS. At first, I tried creating an image slider on h5p.org, turns out adding images in chrome doesn't work for me (same console error), only in IE.

Michel Cardinal's picture

Hi,

I got the same problem, but i'm not a technician, I install Moodle on my web site by my self and I'm learnig by myself too for each problem I got, so is it possible to know how to fixed this problem with the error message saying too large file in H5P, I got this message sometime whit somme video and the size is under 1g and all the set up is ok in my cPanel for the max load file etc at 1gig.

I also got the message error file too large with an jpeg image at 835k after turnig around and around and around for about 5 minutes the message appear, file too large size.

So I think it's not realy a propblem whit the size of my files.

Is there a tutorial that can explain me step by step how to fixed it. Again I'm not a technician, so I need a tutorial very step by step.

Thank's a lot

Thank You !!! It works now.

icc's picture

It's good to hear that you got it working!

I just had the same problem runing MariaDB through docker. While installing h5p I see some complaint of the installer:

Specified key was too long; max key length is 767 bytes for query CREATE TABLE wp_h5p_tmpfiles (

 

which seems to be related to this http://stackoverflow.com/questions/1814532/1071-specified-key-was-too-lo...

 

Creating the table manually also made the fix for me. Thanks.

icc's picture

Ah, I thought this had been fixed and released already. I'll make sure it's fixed in the next version of the plugin.

Thank you for letting me know. Creating the table yourself is perfectly safe and will be compatible with future versions of the plugin.

Hello,

I get the same error when using Dictation and use the integrated sound recorder. When I record sound < 10 seconds, the file is well uploaded, but if I record a longer audio, ex. 15 seconds, I get this error (file might be too large).

My upload limit is 16 MB so it is not linked to the upload size limit.

As I can upload smaller files, it is not linked to write access rights.

Looking at the console in Chrome, when trying to insert the newly recorded audio of 15 seconds, I get the following errors:

SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
at XMLHttpRequest.request.onload(https://wp.mywebsitename.com/wp-content/plugins/h5p/h5p-editor-php-libra...)

 

Any clue to help me?

Thanks

otacke's picture

Hi!

The file length message unfortunately is quite a "catch all" message that may be displayed by the H5P core for other issues as well. It seems that the server wants to reply with some HTML page (that would start with a <) probably exactly describing what went wrong, but an HTML page is not something that H5P core expects here. You should have access to the network tab of the developer tools as well (you attached a screenshot of the console already). There you should find some entry that's put there when uploading the file, and one of the sub tabs (could be "body" or "preview" or "response", I don't recall the exact label right now) should show the full HTML message with more details).

Best,

Oliver 

Hi,

Thanks for your message. Effectively looking at the network tab, selecting the red request, and looking at the Response subtab, I get a 413 Request Entity Too Large error.

But then I don't know why as the php parameter seems to be well defined (as I can check on Wordpress as you can see on attached capture).

Any other clue to fix the problem?

Thanks.

Hi again,

Thanks to your help, I found on Google that it could be a restriction of Nginx server, which limits by default uploads to 1MB. I changed settings in Nginx config and now I can record and upload bigger sound samples.

Thanks again for your help.

For your information, here are information on how to increase or limit upload size on Nginx ; https://www.tecmint.com/limit-file-upload-size-in-nginx/

otacke's picture

Hey looloo06!

Kudos to you! I really love if people - even though it feels hard - try to use a search engine in order to figure things out themselves! And thanks for sharing, so other can benefit from your findings.

Best,
Oliver