• Welcome to PHPVIBE Forums. Please log in.

[ Video Sharing CMS v4 ] How to ... include video-upload?

Started by Heiby,

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

HeibyTopic starter

Hello,
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.
Heiby
  •  

PHPVibe A.

Hi,

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

HeibyTopic starter

Hi,
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.


Heiby
  •  

PHPVibe A.

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?

PHPVibe A.

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

HeibyTopic starter

... 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.
  •  

PHPVibe A.

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" >
$(document).ready(function(){
	$('#dumpvideo').MaxUpload({
		maxFileSize:3145728000,
		maxFileCount: 1,target: lib/upload-ffmpeg.php',	
        allowedExtensions:['.flv','.mp4','.avi','.mpeg','.wmv','.mov','.m4v','.3gp','.mkv','.mpg','.wmv',],
        data: {"token": "af844ad893f5700f67a625a490973d80"},
        onComplete: function (data) { processVid(data);  },
		onError: function () {  }		
	});
	 });

With a
<div id="dumpvideo"></div>


as rendering stage/container.


HeibyTopic starter

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.
Heiby
  •  

PHPVibe A.

What is the actual problem? Open the browser console, what does it say?
Try to make thouse links full, like http://www.site.com/lib/maxupload.js

HeibyTopic starter

I changed the URI like  http://www.site.com/lib/maxupload.js

2 warnings in the console:
1) Uncaught ReferenceError: jQuery is not defined(anonymous function) @ maxupload.js:316
video-upload.php:20
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
  •  

PHPVibe A.

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

HeibyTopic starter

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: http://www.domain-name.com/phpvibe/lib/upload-ffmpeg.php',

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


  •  

PHPVibe A.

My bad, try this

target: 'http://www.domain-name.com/phpvibe/lib/upload-ffmpeg.php'

forgot an '

PHPVibe A.

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

HeibyTopic starter

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  ;)

  •  

HeibyTopic starter

Hi,
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
 the_header();
 include_once(TPL.'/default-full.php');
 the_footer();

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,
Heiby
  •  

PHPVibe A.

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.


HeibyTopic starter

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?

Heiby
  •  

PHPVibe A.

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?

HeibyTopic starter

Hi,
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 www.my-domain.com to www.my-domain.com/upload-video.php where www.my-domain.com/phpvibe/add-video 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-91.14.228.72
Domain:	.my-domain.com
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




  •  

HeibyTopic starter

... 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.

Heiby
  •  

PHPVibe A.

Hi,

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()) {
user::LoginUser(3);
}


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

HeibyTopic starter

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.
Thanks,
Heiby
  •  

PHPVibe A.

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) {
user::clearSessionData();
}


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

HeibyTopic starter

Sorry - but the site stops processing, when it reaches:
if(!is_user()) {
user::LoginUser(3);
}


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

Similar topics (7)