Related Topics

[Video CMS v4]How to ... include video-upload?  (Read 1027 times) Print

1 2 All B

Heiby  June 05, 2015, 05:01:31 PM

I've installed phpVibe in a subfolder (path: htdocs/phpvibe/index.php).
Now I want to include the phpvibe-video-upload-function into the website, that I can upload videos from a file placed 1 level higher (path: htdocs/video-upload.php).

I've tried already successless - so I haven't any idea, how this works.
Does anyone know, which changings I have to do, that I can use the phpvibe-Upload 1 level higher?

Thanks in advance.


Alexander  June 05, 2015, 05:09:10 PM


this is isn't an easy thing to do, since the uploader consists of a few elements:
- the maxupload.js file
- the handler (upload.php of upload-ffmpeg.php in /lib)
- the form which is being made visible once the upload is finished, the one in com/com_add.php


Heiby  June 05, 2015, 05:40:50 PM

thanks for the fast reply.

And which file I have to include then (URI), that the uploader and upload-form will be showed in my video-upload.php?
Because the URI (folder / file) -> http...phpvibe/add-video  istn't really existing.



Alexander  June 05, 2015, 05:43:15 PM

but, this is the problem, it's not an file include, is not that easy.
I've never did this or bumped into a client that needed it.
I think you have to build your own external upload plan, and just hook the command to store the video in PHPVibe.

Using load.php and the is_user(), maxupload.js and all of the rest.
Are you sure you really need this? It would be a lot of work to do. Why not just redirect/link them?


Alexander  June 05, 2015, 05:44:31 PM

Basically, if you look at com/com-add.php you will see all the upload logic.


Heiby  June 05, 2015, 05:58:15 PM

... because we need the excellent phpVibe-Software only in the background: video-upload, video-management, newsletter, and other features.
The frontend is an own written software for a kind of "challenges", where the users must upload videos to special challenges, for what phpvibe isn't developped.

Yes, the com/com-add.php I've already found ... and I can already write my own database-fields that I need.
And now, I wanted to include the "upload"-function.
For this feature I would need only the upload-function without the form for further information.


Alexander  June 05, 2015, 06:54:44 PM

Ok, got it, here you go, the file is lib/maxupload.js

It can be triggered like:
<!-- The basic File Upload plugin -->
<script src="/lib/maxupload.js"></script>
 <script type="text/javascript" >
maxFileCount: 1,target: lib/upload-ffmpeg.php',
        data: {"token": "af844ad893f5700f67a625a490973d80"},
        onComplete: function (data) { processVid(data);  },
onError: function () {  }
With a
<div id="dumpvideo"></div>

as rendering stage/container.


Heiby  June 05, 2015, 07:42:42 PM

Many thanks for taking time and finding a solution.

But it doesn't work. What could I have made wrong?

File: video-upload.php (in Folder /htdocs in relation to /htdocs/phpvibe/)
I changed the paths:
<script src="phpvibe/lib/maxupload.js"></script>
maxFileCount: 1,target: phpvibe/lib/upload-ffmpeg.php',

Then I put
<script src="phpvibe/lib/maxupload.js"></script>
into the Head.

Directly after the h1:
<div id="dumpvideo"></div>

Where do I have to put your javascript exactly? Head or body?
Is there anything else, what I have to do?

Thanks in advance.


Alexander  June 05, 2015, 07:44:37 PM

What is the actual problem? Open the browser console, what does it say?
Try to make thouse links full, like


Heiby  June 05, 2015, 08:01:18 PM

I changed the URI like  newbielink: [nonactive]

2 warnings in the console:
1) Uncaught ReferenceError: jQuery is not defined(anonymous function) @ maxupload.js:316
2) Uncaught SyntaxError: Unexpected token ILLEGAL

Then I also changed the com_add.php und took off:
if(!is_user()) { redirect(site_url().'login/'); }
and gave an existing user_id


Alexander  June 05, 2015, 08:22:18 PM

You need to load jquery in that page, it's a jquery plugin, it depends on jquery.


Heiby  June 05, 2015, 08:30:20 PM

Now I took of the error in line 20.

Oooppss - no jquery ... so linked to a jquery-lib.

Now still 1 error: Uncaught SyntaxError: Unexpected token ILLEGAL
maxFileCount: 1,target:',

I tried also "phpvibe/lib/upload-ffmpeg.php".


Alexander  June 05, 2015, 08:33:28 PM

My bad, try this

target: ''
forgot an '


Alexander  June 05, 2015, 08:34:08 PM

I'll catch you up later, will try to log from home, shift got over 30 min ago and the building is closing.


Heiby  June 05, 2015, 08:53:04 PM

Now there aren't any mistakes in the console  ;D

But the Uploader is still not included yet.

In the com_add.php is the login-function off:
// if(!is_user()) { redirect(site_url().'login/'); }

Where do I have to set the user_id() exactly?
And what? The real name oder the hashed?

Do I have to set other variables as well?

No problem - so I can take a break as well  ;)


Heiby  June 06, 2015, 02:11:49 PM

on this way it cant't really work.

1) In the com_add.php are variables written for the head and body.
So I have to include this file into the head, that I can put out the variables differently in the head and body.

2) But then I have collisions with:
//Time for design
So I have to delete this und write own functions.

3) Then I have to include all the functions of phpVibe to my site that these are running as well.

So it would be very nice, if you could tell me, which file I have to "speak to" first, for being able to include the Uploader.
That means com_add.php and upload.php in the head? ... with the right paths to other files  ;)

Thanks in advance,


Alexander  June 08, 2015, 02:08:18 PM

Heiby, there is no way to include this like how you try.

Use load.php to get access to all functions, including user check.
Use maxupload.js on your custom page, and process them there (like lib/upload.php does, or lib/upload-ffmpeg.php if you use ffmpeg).
This is purely theoretical, since I've never needed this, so I can't know for sure which are the barriers.

I can explain you the functional flow of PHPVibe (this is what I am here for):

- com/com_add.php renders the forms and output to the default page theme
- maxupload.js handles the actual html5 upload, sends the files to lib/upload-ffmpeg.php (if ffmpeg is on) or lib/upload.php (if ffmpeg is off)
- lib/upload-ffmpeg.php sends the video to conversion at videocron.php via an exec
- maxupload.js then enables the form on com/com_add.php , upon save the file itself handles the video update with the values in the form.

This is the process inside PHPVibe.


Heiby  June 08, 2015, 05:06:33 PM

Thanks for the answer.
So have to go to PLAN-B   :(

I wanted to include "add_video" by iframe. It works pretty much until the video is load uploaded.
But then their isn't any the OK- or Save-Button, and no video was saved in the database.

I think, because of the missing Session-Variables.
These are written:
[logintype] => core
[name] => Heinz
[group] => 4
[username] => heinz
[user_id] => 2
[avatar] => uploads/def-avatar.jpg
[pass] => e390f4169fb8e2749f441dafa92f89a7
[usergroup] => 4
[token] => 454da57fbe8e05d33e030df4a924392a
[HTTP_USER_AGENT] => 52fcc5c9bb837e35bcdb6a6f0af6ef5e
[ulikes] =>
[uhistory] =>
[likes_id] => 4
[history_id] => 5
[later_id] => 6
[lastNoty] => 1433763358
Do you know, which are used in "add_video"?
Or where can I switch of almost all of them?



Alexander  June 08, 2015, 06:18:52 PM

Open the browser console, see if any error shows up inside the iframe, I guess the function doesn't fire to enable the form submission when upload finishes, I understand correct?


Heiby  June 09, 2015, 02:34:18 PM

sorry - yesterday it didn't work. Today, without any changings, it works ???
Video is up!

Next step: Overgive own Session-ID and create phpVibe-Cookie!

Our users coming from newbielink: [nonactive] to newbielink: [nonactive] where newbielink: [nonactive] is included per iframe.

We set a Session-ID, but phpVibe needs an own Cookie, so that phpVibe knows that our user is logged in.
For example:
Name:	b8955456185a7bb623e65a6a387f81dd200
Content: 1-phpv-9de9e76d81464ce25b19d6abb677d4d1-phpv-
Pfad: /
So I should know, how the "Name" and the "Content" is created to set a 2nd Cookie with the phpVibe-Parameters.

Thanks in advance,


Heiby  June 09, 2015, 02:40:58 PM

... or how to delete all the needed user-verifications, so that everyone that comes to this page can upload videos - that would be the best.

So I could check by our Session-Id, if someone is allowed to upload videos only by my own.



Alexander  June 09, 2015, 04:56:10 PM


the cookie name is under Settings -> Login, it's also good to check lib/functions.user.php (has all you're looking for ;) )

You can do this:

if(!is_user()) {

Change 3 to an user account's id created for a "Guest" or how you wish to call it ;)


Heiby  June 09, 2015, 05:26:35 PM

Thanks for the "easy" option - is it really that easy?

But... do I have only to change the code in the com_add.php (line1) or e.g. in the load.php as well, because there are the functions "authByCookie(); validate_session();". There is the "if (!is_user()..." written too.

But then ... the whole phpVibe is generally opened for all guests? Or only the "/add-video", because of the changed com_add.php?

It needs 3-4 hours until the testserver is ready for trying it in real ;-) ... I'll give you a reply then.


Alexander  June 09, 2015, 05:37:24 PM

Change it in your file, not in PHPVibe, after you include load.php

And you can do this in index.php of PHPVibe

if(is_user() && user_id() == 3) {

This will log him off if the visitor is on that account.  ;)


Heiby  June 09, 2015, 07:37:48 PM

Sorry - but the site stops processing, when it reaches:
if(!is_user()) {

So I think, it cannot handle "user::LoginUser(3);:-\
either a session-id is existing.


Heiby  June 09, 2015, 07:47:24 PM

Ooopppsss - sorry ... I've forgotten to require the functions  :-[


Heiby  June 09, 2015, 08:06:50 PM

And 12 points go to ................
the support of phpVibe - especially to you, Alexander.

A very good solution, which is working now!
And a one, than trying to write something own. Because when phpVibe is being upgraded in future, there isn't anything to do anymore  8)

I'm very lucky about this.
Many, many thanks to you.


Heiby  June 09, 2015, 11:26:30 PM

Hello Alexander,
the next problem is including the JW-Player.

We bought the actual version of phpVibe, where a licence for the JWPlayer is automatically included.
So we've got the licence to use the JWPlayer also commercially (within the phpVibe-Software).

Now my question:
We use phpVibe on our Website ... do we can download newer JW-versions and integrate it into our Website in a separate folder by our own? ... with the licence of phpVibe included?



Heiby  June 10, 2015, 12:57:41 PM

we have a problem with the Upload.

When I upload Videos, it works several times very well - but then suddenly the upload stops and isn't finishing.
When I change the user in my file, it works again.

My question:
Are there any restrictions how many MB or videos a user may upload?
And where can I change this?
I've already searched in the code, but I did't found anything yet.

Thanks in advance.


Alexander  June 10, 2015, 05:53:09 PM


you can overwrite the lib/players/jwplayer/ with the files from your own pro/ads version, no problem, you can add the key via settings, if you need to alter the embed code for it open lib/class.provider.php, it's commented.


Alexander  June 10, 2015, 05:54:44 PM

For restrictions, there are none, there is a size restriction in settings for how big the files can be.
Sounds more like a session issue somewhere, can you check it server side? Any firewall, mod_security on server?