Upload .h5p content #1632
Replies: 2 comments 5 replies
-
On the server-side you need a route that accepts a file upload from a HTML form (you need the Express file upload middleware). The route calls H5PEditor.uploadPackage and then immediately calls H5PEditor.saveOrUpdateContent. You can check out how we do this in the Lumi Desktop app here: https://github.com/lumieducation/lumi/blob/811e9b899eb9df5a31f8024ec392fdbbd96a3747/server/src/controllers/LumiController.ts?plain=1#L95 In startPageRenderer.ts you need to add a basic HTML form that allows the user to select a file and that calls the route from above when you click on a submit button. (see https://www.w3schools.com/howto/howto_html_file_upload_button.asp) |
Beta Was this translation helpful? Give feedback.
-
Open the .h5p file in Lumi (https://lumi.education) and check if the image is shown there. If it is, the problem must be in the upload and not in the download process. Please post the resulting .h5p file here if the image is missing in it in Lumi. You've commented out h5pEditor.saveOrUpdateContent in express.ts:278. You need to do this, otherwise the content is not saved properly. You're using a very old version of the library before it became a monorepo. You simply need to install and import the |
Beta Was this translation helpful? Give feedback.
-
Hi i am using your library to implement h5p content as per our need.
I have successfully installed your git code and modify it according to our need.
i am using mongo db to store h5p created data and aws bucket to store file.
i am using combine your h5p-examples packages with mongodb.
Now i want to upload h5p content using custom button in startPageRenderer.ts file of h5p-examples package.
Can you help me how can i do this?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions