This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
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
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
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 said:
ERROR on my app help plz
when i try use (somenting wrong on account user)
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
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.
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?
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'))];
}
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 (((
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.
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.
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
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
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.
Octobercms ajax form to save files is working fine for me. Here are some of the code from my project.
- 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()}}
-
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
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?