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

pratyushpundir6424
pratyushpundir6424

LOL.. That's ok..

For this new error - I think $model is not what it should be. I see you are assigning it in your component as follows:

$model = new PetfieModel;

This will of course not work unless "PetfieModel" is an alias to your actual fully-qualified model classname. Judging from the table name the fully-qualified classname for your "Petfie" model should be "Rahman\Galleries\Models\Petfies", so in that case your assignment statement will need to be something like this:

$model = new Rahman\Galleries\Models\Petfies;

Everything else should be ok..

Fibonacci
Fibonacci

pratyushpundir6424 said:

LOL.. That's ok..

For this new error - I think $model is not what it should be. I see you are assigning it in your component as follows:

$model = new PetfieModel;

This will of course not work unless "PetfieModel" is an alias to your actual fully-qualified model classname. Judging from the table name the fully-qualified classname for your "Petfie" model should be "Rahman\Galleries\Models\Petfies", so in that case your assignment statement will need to be something like this:

$model = new Rahman\Galleries\Models\Petfies;

Everything else should be ok..

Sometime, I break the rules to get fast example.

I have changed the model to Petfies but still persist.

FYI, before, I used alias in the class of component like this use Rahman\Galleries\Models\Petfie as PetfieModel;

Fibonacci
Fibonacci

alxy said:

Guys, if you need Frontend-File upload with files attached to a model use this excellent plugin: https://github.com/responsiv/uploader-plugin

If you follow the steps in the README and your relation is set up correctly it works like a charm.

I have tried and it's work. But, how to implement with RainLab.User? Like an avatar image.

SpankyP
SpankyP

alxy said:

Guys, if you need Frontend-File upload with files attached to a model use this excellent plugin: https://github.com/responsiv/uploader-plugin

If you follow the steps in the README and your relation is set up correctly it works like a charm.

Could you please consider writing a bit more of an in-depth install instruction for this plugin? I've run into several issues that have yet been unresolved here:

http://octobercms.com/forum/post/uploading-files-via-responsivuploader

@Fibonacci, how did you manage to get it to work?

Iocare
Iocare

https://github.com/responsiv/uploader-plugin this plugin works without maing any changes or creaditng any additional model. RainLab.User Plugin already has:

    public $attachOne = [
        'avatar' => ['System\Models\File']
    ];

I've just written following code in Page init:

function onInit()
{
    $user = Auth::getUser(); //Get Logged in user
    $this->imageUploader->bindModel('avatar', RainLab\User\Models\User::find($user->id));
}
SpankyP
SpankyP

iocare said:

https://github.com/responsiv/uploader-plugin this plugin works without maing any changes or creaditng any additional model. RainLab.User Plugin already has:

Right thanks @iocare I have the avatar function working fine, but how do you use this plugin for uploading images in general, to a different model?

janedoe
janedoe

iocare said:

https://github.com/responsiv/uploader-plugin this plugin works without maing any changes or creaditng any additional model. RainLab.User Plugin already has:

   public $attachOne = [
       'avatar' => ['System\Models\File']
   ];

I've just written following code in Page init:

function onInit()
{
   $user = Auth::getUser(); //Get Logged in user
   $this->imageUploader->bindModel('avatar', RainLab\User\Models\User::find($user->id));
}

hey i used your code and i get this error Call to a member function bindModel() on a non-object

21-27 of 27

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