Issues with adding a “plupload” plugin to a site.
Recently I was working on adding a plupload plugin to the video-migrator site. It is a s tool that allows the file upload process to be executed in chunks.
The video-migrator site uses Kaltura to process two video files and put them together as one movie, picture-in-picture.
The installation and set up was fairly quick and simple (for someone who doesn’t know Laravel environment that well yet 😉 ).
The problems starter to come out when I wanted to update some of the initial values dynamically. According to the documentation it was possible and not complicated… except that it didn’t work.
Whatever I set when initialising the plupload that was it. Even when dynamically changed (by using jquery) one of the set up options, it was not passed to the php scrip handling the upload. The variable itself was updated to the new value but this new value was just not passed in the POST.
To overcome this issue I had to use ajax and somehow identify the files I just uploaded. The solution was to use a unique temporary folders to store the uploaded files. The trick was to generate the unique folder name before the upload and keep it unchanged/re-generated in the code for the whole upload process.
Once the files were uploaded to the server another ajax call sent the temp folder name to the php script along with the other values I needed (movie titles).
I also had to know which file should be a primary and which secondary one but that was an easy fix with two plupload instances where I could set a tag to specify this.
Based on that I was able to update the files metadata and continue with the task. It was then easy process of creating the xml file for Kaltura to pick up a “job”.
I have tried to identify if the issue is only related to my local set up but my co-workers had the same problem.
A simple workaround solved the issue but I’m still not sure why it wasn’t working as expected in the firs place. Maybe I will have to speak to the plupload tool creators…
Thank you for reading and all the best.