This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

alyssa_00515427
alyssa_00515427

I have this error T_T


We're sorry, but an unhandled error occurred. Please see the details below.
Method name must be a string

plugins\contest\form\traits\ComponentUtils.php line 84

er.shajidkhan13974
er.shajidkhan13974

I have a video gallery page in my website but i want to add videos from backend and not at cms page.is there any plugin for that? if not how to create plugin for the same? i am totally new dont know how to create plugin

Iocare
Iocare

I'm using clone of responsiv available at https://octobercms.com/plugin/netsti-uploader

Make sure this component is placed by code initiation not by dragging it on page.. A better way is to add it dynamically by using following code on onInit of code section of a page. Assuming we want to add avatar/profile pic for account page, add :

{% component 'imageUploader' %}

anywhere you want to put upload box. For example in my case I've added above line in update.htm partial (overridden) of user component. This will display upload box in account page above update account form.

After this add following code to account page code section:

function onInit()
{
    $user = Auth::getUser();
    if($user){
        $component = $this->addComponent(
            'NetSTI\Uploader\Components\ImageUploader',
            'imageUploader',
            ['modelClass'=>'RainLab\User\Models\User','modelKeyColumn'=>'avatar', 'deferredBinding' => false]
        );

        $component->bindModel('avatar', $user);
    }
}

Here modelClass is the class in which to relate picture (avatar) and modelKeyColumn is the column name to which this pic to relate.

EDIT: add code in onInit function instead of onStart.

judeudemolidor
judeudemolidor

ERROR on my app help plz Alt text

Last updated

judeudemolidor
judeudemolidor

judeudemolidor said:

ERROR on my app help plz Alt text

when i try use (somenting wrong on account user) Alt text

janedoe
janedoe

iocare said:

I'm using clone of responsiv available at https://octobercms.com/plugin/netsti-uploader

Make sure this component is placed by code initiation not by dragging it on page.. A better way is to add it dynamically by using following code on onInit of code section of a page. Assuming we want to add avatar/profile pic for account page, add :

{% component 'imageUploader' %}

anywhere you want to put upload box. For example in my case I've added above line in update.htm partial (overridden) of user component. This will display upload box in account page above update account form.

After this add following code to account page code section:

function onInit()
{
   $user = Auth::getUser();
   if($user){
       $component = $this->addComponent(
           'NetSTI\Uploader\Components\ImageUploader',
           'imageUploader',
           ['modelClass'=>'RainLab\User\Models\User','modelKeyColumn'=>'avatar', 'deferredBinding' => false]
       );

       $component->bindModel('avatar', $user);
   }
}

Here modelClass is the class in which to relate picture (avatar) and modelKeyColumn is the column name to which this pic to relate.

EDIT: add code in onInit function instead of onStart.

Call to undefined method October\Rain\Database\QueryBuilder::getDefaultFileTypes() it is giving this error not getting clear how to use

janedoe
janedoe

Dear Developer i have used resposiv/uploader plugin and created model.I also import namespace in plugin registration file plugin .php as use Project but still i am getting this error.Class Project not found.It will be very helpful if this plugin works.

janedoe
janedoe

RomaldyMinaya said:

Hi everyone,

I tryed implementing the responsiv/uploader but after the image has been uploaded, it throws en exception:

The code is:

function onStart()
{
   $this->imageUploader->bindModel('avatar', $this->user);
}

Note that I'm using this in a page that has the account component dropped inside so I can use $this->user to refference the current user.

Dear sir whenever i use this plugin i got this error class Project not found error.but i have created the model named as project and also called in my plugin using use.i am stuck what to do?

spinkalher
spinkalher

Thank you It's working

We add this line...add pass session key

public function onSave() {
return ['error' => \KRYPTOS\donor\Models\Donor::create(post('Donor'), post('_session_key'))];
}

maxDubovsky
maxDubovsky

spinkalher12320398 said:

Thank you It's working

We add this line...add pass session key

public function onSave() {
return ['error' => \KRYPTOS\donor\Models\Donor::create(post('Donor'), post('_session_key'))];
}

You mean for deffered bindings it's working ? Have you tried reusing it from another component ? I have problems there with defered bindings (((

spinkalher
spinkalher

maxDubovsky said:

spinkalher12320398 said:

Thank you It's working

We add this line...add pass session key

public function onSave() {
return ['error' => \KRYPTOS\donor\Models\Donor::create(post('Donor'), post('_session_key'))];
}

You mean for deffered bindings it's working ? Have you tried reusing it from another component ? I have problems there with defered bindings (((

I have injected fileuploader component in my CustomComponent and it works please let me know what issue you are facing.

janedoe
janedoe

finally the plugin starts working but getting following error. 1.in single file upload component it uploads file but preview only title of the file. 2.In multiple file upload component it uploads all type pictur as well as other files but as i refresh page all dissapear.

SeriousKen
SeriousKen

I know this thread is a bit old, but I found none of the plugins met my needs so I submitted a pull request https://github.com/octobercms/october/pull/2857

This builds the request using FormData, which is supported by most modern browsers, and allows the use of native file upload submission by AJAX

saquib.rizwan27636
saquib.rizwan27636

Try picking the file from the laravel HTTP request variable.

$files = $request->file('photos');

And try uploading it via Laravel Store function.

$filename = $photo->store('photos');

Take a look at the multiple file upload in laravel article for a better explanation.

Last updated

Fick1995
Fick1995

Awesome thread i awe to you guys, thanks for teaching here.

maxDubovsky
maxDubovsky

spinkalher said:

maxDubovsky said:

spinkalher12320398 said:

Thank you It's working

We add this line...add pass session key

public function onSave() {
return ['error' => \KRYPTOS\donor\Models\Donor::create(post('Donor'), post('_session_key'))];
}

You mean for deffered bindings it's working ? Have you tried reusing it from another component ? I have problems there with defered bindings (((

I have injected fileuploader component in my CustomComponent and it works please let me know what issue you are facing.

Sorry for such a late delay with my answer, but I managed to solve it also.

netsmertia
netsmertia

Octobercms ajax form to save files is working fine for me. Here are some of the code from my project.

  1. Normal html form with multipart/form-data, onSuccess and onError handle the flash message and attach validation error messages to each fields.
{{form_ajax('onSave', {flash: true, files: true, success: "onSuccess(data)" , error: onError})}}
    //other fields
    <input type="file" id="images" name="images[]" accept=".jpg,.jpeg,.png,.gif,.svg" multiple="multiple">
    //other fields
{{form_close()}}
  1. PHP function to handle ajax request Need to save images and attach with model.

    public function onSave() {
    
        $property = new Property();
        $property->fill($request->post());
        $property->features = $request->get('features'); // relation
        //validation part
        $property->save();
       //saving the images
    if (Input::has('images')) {
            $images = Input::file('images');
            for ($i = 0; $i < count($images); $i++) {
                $imageModel = new PropertyImage(); // custom file to be saved in separate table
                $imageModel->data = $images[$i];
                $imageModel->is_public = true;
                $imageModel->save();
                $property->images()->add($imageModel);
            }
        }
    //response 
    }

    Thanks

mark.brill57446
mark.brill57446

Hi all i am looking for a little help, i have the plugin installed and i am trying to do avatar upload with it. Ihave it called on the page, it previews the existing avatar and will remove the avatar, but the browse button does nothing and i cant drag a new image to it. any thoughts?

xyz.qtc63355

21-39 of 39

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.