xoops forums

goffy

Quite a regular
Posted on: 3/7 8:16
goffy
goffy (Show more)
Quite a regular
Posts: 321
Since: 2010/12/27
#1

Usage of fineupload

Hi

I realized that xoops now includes fineupload (https://fineuploader.com)

I'm playing a little bit around with that, but I don't get it working.

Is there somewhere an example, how I can add a drag&drop area to my module template and how I can then handle the uploads?

geekwright

Quite a regular
Posted on: 3/8 23:26
geekwright
geekwright (Show more)
Quite a regular
Posts: 240
Since: 2010/10/15
#2

Re: Usage of fineupload

Someone was going to write up a howto, but I never saw it.

Here are examples of all of the pieces:

Initialize fineuploader
- htdocs/modules/system/admin/avatars/main.php
- htdocs/modules/system/templates/admin/system_avatars.tpl

Handling the Upload
- htdocs/ajaxfineupload.php
- htdocs/modules/system/class/fineuploadhandler.php
- htdocs/modules/system/class/fineavataruploadhandler.php

In the initialize phase, your code sets up the javascript front end the user interacts with.
The existing uses in XOOPS assign variables used a Smarty template to build the JS code.
One of your code's major responsibilities is to build the JSON Web Token that is used in
authorization for any uploading and controls the handling of the uploaded file(s).

The payload for the JWT needs to have these claims.

'aud' => 'ajaxfineupload.php',          // program to process the token (audience)
'uid' => $user,                         // what user can use this token
'handler' => 'fineavataruploadhandler'// handler class that will store the file
'moddir' => 'system',                   // module handler belongs to

Any other information you might need to pass to your handler can be added to the token.

On the upload, the ajaxfineupload.php is a generic endpoint that handles the upload process,
including security, i.e. verifing the claims. It then loads the specified handler class, giving
it access to the claim data and the file to be stored. The handler should take care of any
additional needs like database entries to identify the upload.

I hope this helps.

goffy

Quite a regular
Posted on: 3/10 7:02
goffy
goffy (Show more)
Quite a regular
Posts: 321
Since: 2010/12/27
#3

Re: Usage of fineupload

hi geekwright

thank you for explanation. I will try to find out what is going on there
and I hope I can present the results soon