Giter Site home page Giter Site logo

uploader-plugin's People

Contributors

alvaro-canepa avatar alxy avatar daftspunk avatar gergo85 avatar gpasztor87 avatar greggunner avatar sixgweb avatar tobias-kuendig avatar upperfoot avatar vardash0131 avatar webmaxx avatar webvpf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uploader-plugin's Issues

[Question] Uploading under same-site subdomain

I'm trying to figure this out, but is it possible to upload under a subdomain but on the same site?

for instance in uploader.js if i make it like this:

    FileUpload.DEFAULTS = {
        url: 'https://subdomain.domain.com' + location.pathname,
        uploadHandler: null,
        sortHandler: null,
        uniqueId: null,
        extraData: {},
        paramName: 'file_data',
        fileTypes: null,
        maxFilesize: 256,
        template: null,
        isMulti: null,
        isPreview: null,
        isSortable: null,
        thumbnailWidth: 120,
        thumbnailHeight: 120
    }

I get this error:
AJAX handler 'onUpload' was not found.

This only happens when doing this under a different domain other than what the current domain is. If it's the same domain then it works fine.

iOS camera orientation issue

Just let you know, there is an issue with uploading the photo directly from the iOS camera (without saving the photo to the device). When the photo is taken as portrait, a thumbnail is showed as landscape.

It seems to be an issue in Dropzone.js. I tried to update to Dropzone 5.2.0 but the problem is still there. So I want to mention it here because a lot of people using this plugin and maybe will have the same problem.

Screenshot attached:

screen2

I tried many patches from Dropzone Github, but nothing works. I have to add a special button for rotating image manually.

Moved to AWS, script type="text/template" not working

I just moved to AWS, and noticed script type="text/template" does not work properly in image-single.htm. Notice how the open DIVs don't close. I tried making it simple, and removed everything inside the script block but one single

, then the output is similar, as it doesn't display the closing .

    <!-- Template for new file -->
    <script type="text/template" id="uploaderTemplateimageUploader">

            <div class="upload-object dz-preview dz-file-preview">
                  <a
              href="javascript:;"
              class="upload-remove-button"
              data-request="imageUploader::onRemoveAttachment"
              data-request-confirm="Replace picture?"                 >
                    <div class="icon-container image">
                        <img data-dz-thumbnail class="avatar img-circle" style="width: 160px;height: 160px;" />
    </script>

This is what happens when I have single DIV

<script type="text/template" id="uploaderTemplateimageUploader">

    <div>

</script>

Image preview width and height on component does't work.

I changed Image preview width and height on image component but still using the default parameter of 100px. On frontend when i use:
{{ imageUploader.imageWidth ?: '0' }}
i get the default parameter and not that i have enter on component.

$(...).render is not a function at uploader.js

I always have this error when I don't hard refresh the page.

Uncaught TypeError: $(...).render is not a function at uploader.js:319 at uploader.js:323 (anonymous) @ uploader.js:319 (anonymous) @ uploader.js:323

I have looked online and I have
{% framework extras %}

and then
{% scripts %}

if I change
$(document).render(function () { $('[data-control="fileupload"]').fileUploader() })

to

$(document).ready(function () { $('[data-control="fileupload"]').fileUploader() })
it works perfectly. Does anyone have any idea of how I can fix this issue without changing this line of code in uploader.js?

How to refresh file upload?

Anybody knows how to refresh file upload after the form is sent? How to remove selected file, when the form is successfully sent and persisted?

I tried:

<form ... data-request-success="$('this').request('{{ __SELF__ }}::onRefreshFiles')" ...

with:

public function onRefreshFiles()
{
    $this->pageCycle();
}

but only I can see in Chrome console is an infinite loop of requests.

Upload of non-public files

Is there a specific reason for the hardcoded "is_public" property in the ComponentUtils trait ?

Are there any issues in passing it when binding the model to the component?

I mean something like:

public function bindModel($attribute, $model, $is_public = true)

Validation Extension and Max Size Issue attaching from component

here is my code from a component:

        $component = $this->addComponent(
            'fileUploader',
            'companyFileUploader', [
                'deferredBinding' => false,
                'placeholderText' => "Click or drag files to upload",
                'maxSize' => "15", // 15 MB
                'fileTypes' => ".pdf",
            ]
        );
        $component->bindModel('attachments', $this->company);

And when I try to upload a PDF file from my form:

  • I have validation.extensions message displayed below the file (which is not uploaded).
  • or i have The file data may not be greater than 5120 kilobytes. message, which does not take in account the 15MB (which is not uploaded)

Responsiv Uploader version 1.0.4

Class '\User\Plugin.Name\Models\__uploader' not found

Hello guys, i'm trying to use this plugin, i was able to use it before, but after some code update im implementing it again, but now there is an error and i dont know why.

"Class '\User\Plugin.Name\Models\__uploader' not found"

This error show up when files are trying to upload with a deferredBinding model. Into the html code there is a input named _uploader.

<input type="hidden" name="_uploader[images]" value="">

Any idea?

Thanks!

Maximum size issue when attaching plugin from component

Hi, I have set the maxSize to 5 MB but if I attach a larger file it still gets uploaded, i am attaching the uploader from a component as per the docs :

 $component = $this->addComponent(
           'Responsiv\Uploader\Components\FileUploader',
            'fileUploader',
            [
                'deferredBinding' => true,
                'maxSize ' => 5, // 5 MB
                'fileTypes' => ".jpg, .jpeg, .bmp, .png, .gif, .pdf, .txt, .xml, .doc, .xls, .xlsx, .docx, .csv",
            ]
        );

        $component->bindModel('attachments', new Ticket );

and in my partial I just add {% component 'fileUploader' %}

Init Page Problem

Hello,

I have this error on page load:

Method name must be a string
/var/www/html/october/plugins/responsiv/uploader/traits/ComponentUtils.php line 81

this is my code

[fileUploader]

fileUploader->bindModel('avatar', $this->user); } # ?>
{{ form_ajax('onUpdate', { role: 'form', model: user, files: true }) }}
        {% component 'fileUploader' %}

{{ form_close }}

Thanks.

License and Use

Hello,
I did not see this plugin on the marketplace, is there any reason ?
I guess it would be much more easy to install new plugins depending on this one that way.
If not posible, can I insert this plugin into another that I'm developing ?
Bye.

Max size validation in component not used

Hi there,

I noticed that when the 'maxSize' is set in the FileUploader component it does not do anything on validation.

In the code you can see something else is used: https://github.com/responsiv/uploader-plugin/blob/master/traits/ComponentUtils.php#L114

            $validationRules = ['max:'.File::getMaxFilesize()];
            if ($fileTypes = $this->processFileTypes()) {
                $validationRules[] = 'extensions:'.$fileTypes;
            }

Could this be refactored to:

            $maxFilesize = $this->property('maxSize', File::getMaxFilesize());
            $validationRules = ['max:'.$maxFilesize];
            if ($fileTypes = $this->processFileTypes()) {
                $validationRules[] = 'extensions:'.$fileTypes;
            }

I think this is in line with the rest of the code.

Not adding JS and CSS file front end

Hello,
When I am adding {% component 'fileUploader' %} on front end it not working, as I can see in page view source of that page it seems related js and css file is not being added while it showing in admin and working fine in admin section.
Is there any special process add upload files from front end?

Remove image file not working

On page refresh, while using the image uploader component, the plugin fails to delete the file with the following error logged:
TypeError: file is undefined (dropzone.js:1042:1)

Error uploading over 2mb - !Input::hasFile('file_data')

I noticed many of my pictures don't get loaded. It shows the upload is spinning and nothing happens. I tried many image sizes of the same image. Size 2.22 mb fails, while size 2.03 works.
As additional info, I set the maxSize to 10 in the plugin property.

I traced the javascript code and added console error message, then I saw there is an error: 'File missing from request'
I finally traced it to ComponentUtils.checkUploadAction() and somehow this is false:

Input::hasFile('file_data')

I added console.log('error ' + error); in uploader.js:

FileUpload.prototype.onUploadError = function(file, error) {
    console.log('error ' + error);
    var $preview = $(file.previewElement)
    $preview.addClass('is-error')
}

ComponentUtils.php

protected function checkUploadAction()
{
    if (!($uniqueId = Request::header('X-OCTOBER-FILEUPLOAD')) || $uniqueId != $this->alias) {
        return;
    }

    try {
        if (!Input::hasFile('file_data')) {
            throw new ApplicationException('File missing from request');
        }

files not found

I want to upload files in pdf, jpg, ppt, etc. I have written the init function in the component as follows.

$component = $this->addComponent( 'Responsiv\Uploader\Components\FileUploader', 'fileUploader', [ 'fileTypes' => '.jpeg, .pdf, .doc, .docx, .ppt, .pptx', 'placeholderText' => "Browse File", ], ['deferredBinding' => false] ); $component->bindModel('files', new Model));

after uploading the output files return null values "_uploader" => array:1 [▼ "files" => "" ] but it saved in storage. so how I can get files that I uploaded in storage ?

Multiple instances of Plugin not working.

Plugin not working with two/multiple instances of component.

I tried following code

function onInit()
{
    $user = Auth::getUser();
    if($user){
        $this->imageUploader1->bindModel('avatar', $user);
        
        $profile = $user->profile;
        $this->imageUploader2->bindModel('familypic', $profile);
    }
}

with

{{ form_open() }}
            {% component 'imageUploader1' %}
{{ form_close() }}

{{ form_open() }}
            {% component 'imageUploader2' %}
{{ form_close() }}

Im trying this from page.
My problem is both my images get uploaded to avatar (imageUploader1)
even if I upload it though imageuploader2 it gets saved in avatar.

my model code is:

user model already has avatar
and 
Profile Model:
    public $attachOne = [
		'familypic' => ['System\Models\File']
    ];

I even tried following way in page itself.

function onInit()
{
    $user = Auth::getUser();
    if($user){
        $component1 = $this->addComponent(
            'Responsiv\Uploader\Components\ImageUploader',
            'imageUploader1',
            ['deferredBinding' => false]
        );

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

    if($user){
 
        $component2 = $this->addComponent(
            'Responsiv\Uploader\Components\ImageUploader',
            'imageUploader2',
            ['deferredBinding' => false]
        );
        
        $profile = $user->profile;
        $component2->bindModel('familypic', $profile);        
        
    }
}

Please help.

Retrieving deffered uploaded images

i have uploaded multiple images with deffered binding and save them using this method
$project->save(null, post('_session_key'));
they are saved and i can see them on backend but when i try to retrieve them using sitesearch plugin everything in database model is retrieving but cannot get the images , following is my relation
$attachMany=[ 'postingimage'=>['System\Models\File', 'order' => 'sort_order'] ];
follwing is the code in sitesearch plugin for retrieving


if ($item->postingimage) {
                
                   return [
                       'title' => $item->title,
                       'text' => $item->description,
                       'text' => $item->price,
                       'text' => $item->brandname,
                       'text' => $item->name,
                         'thumb'     => $item->postingimage->first(),
                       'relevance' => $relevance, // higher relevance results in a higher
                       'model' => $item, 
                   ];
}

but when i print this model i got the following result

{"title":"gdsag","brandname":"Yamaha","description":"gdsga","price":5887,"name":"Rawalpindi",
"postingimage":[]}

everthing is there except images
Raise this issue on sitesearch plugin as well
OFFLINE-GmbH/oc-site-search-plugin#56

How to get uploaded file

Hi,

I have extended the user plugin and added the file uploader to the user account form which all works fine but i can't figure out how to get the uploaded file and use it on other pages?

Thanks,

after installing unable to parse error

Hi, thanks for great plugin, unfortunately, it broke my october im receving errors everywhere try to open builder from backend error try to open anything else from menu, you bet, Error! I tried using plugin refresh command, same thing error.

vagrant@scotchbox:/var/www/public$ php artisan plugin:refresh Responsiv.Uploader
Rolled back: Responsiv.Uploader
Reinstalling plugin...


  [Symfony\Component\Yaml\Exception\ParseException]
  Unable to parse at line 1 (near "
                              ").

try to force upload from plugin backend, same error again. I tried deleting using plugin:remove and same thing again.

UPDATE: my october is completely broke broke now. i recieve this error on every click almost. i clear the cache etc using artisan and logout for hard refresh but now i can not login it says Unable to parse at line 1 (near ""). GOD 😢

UPDATE: me again so sorry but i just wanted to let you know that i did php artisan october:down successfully while it failed on bring up 😯

 php artisan october:up


  [Symfony\Component\Yaml\Exception\ParseException]
  Unable to parse at line 1 (near "















                         ").

File Uploader attached to partial loaded via AJAX

How do you bind the component to a partial loaded via ajax ?

This is how I usually include it on a page from a component :

public function init()
{
	$component = $this->addComponent(
		'Responsiv\Uploader\Components\FileUploader',
		'fileUploader',
		[
			'deferredBinding'   => false,  
			'fileTypes'         => ".jpg, .jpeg, .png, .pdf, .txt, .doc, .xls, .xlsx, .docx, .csv",
		]
	);
	$component->bindModel('attachments', $this->user );
 	 
}

The problem is if I want to load a partial ( modal ) via ajax that has the fileuploader it does not work. The upload button shows up, I can select files as usual but it never gets saved to the database. Also let's say I click on delete file, it throws an error 'onRemoveAttachment' ajax handler not found.

I tried to add it also in the Ajax function being called but no luck,

Any idea ?

Internet Explorer file uploads

Hello,

The plugin works great, except that i'm unable to open the file picker window. When i click on the upload button in any other browser it works great, but in Internet Explorer it won't open that window.
Is this a known problem, or does anyone have an idea how to fix this?

Thanks in advance.

Trouble in implementing in custom plugin

Hi, i have some trouble
when i click on the browse button rendered by the responsiv/uploader-plugin in my custom plugin, nothing happen. No browser window opening and the drag and drop won't works.

generated code

<form method="POST" action="https://xxxxxxxxx.xxx/en/forum/u/myuser" accept-charset="UTF-8"><input name="_session_key" type="hidden" value="8Idqq6sUYQG3JVWny9Gd5MGcnuFWIKZbrRnOI3Hm"><input name="_token" type="hidden" value="BL47ZH7yPTi0GzVbxHqNMlA7O2jmwX38gxpjGk0N">
    <!-- File uploader -->
    
    
<div class="responsiv-uploader-fileupload style-file-single is-populated" data-control="fileupload" data-template="#uploaderTemplateimageUploader" data-unique-id="imageUploader" data-upload-handler="onUpload" data-file-types=".jpg,.jpeg,.bmp,.png,.webp,.gif,.svg,.js,.map,.ico,.css,.less,.scss,.ics,.odt,.doc,.docx,.ppt,.pptx,.pdf,.swf,.txt,.xml,.ods,.xls,.xlsx,.eot,.woff,.woff2,.ttf,.flv,.wmv,.mp3,.ogg,.wav,.avi,.mov,.mp4,.mpeg,.webm,.mkv,.rar,.xml,.zip">

    <!-- Field placeholder -->
    <input type="hidden" name="_uploader[avatar]" value="">

    <!-- Upload button -->
    <button type="button" class="ui button btn btn-default upload-button">
        Browse
    </button>

    <!-- Existing file -->
    <div class="upload-files-container">
                    <div class="upload-object is-success" data-id="22" data-path="https://xxxxxxxxx.xxx/storage/app/uploads/public/5df/813/126/5df8131265266577151296.jpg">
                <div class="icon-container">
                                            <img src="https://xxxxxxxxx.xxx/storage/app/uploads/public/5df/813/126/5df8131265266577151296.jpg" alt="">
                                    </div>
                <div class="info">
                    <h4 class="filename">
                        <span data-dz-name="">moog-minimoogmodeld-1.jpg</span>
                    </h4>
                    <p class="size">32.50 KB</p>
                </div>
                <div class="meta">
                    <a href="javascript:;" class="upload-remove-button" data-request="imageUploader::onRemoveAttachment" data-request-confirm="Are you sure?" data-request-data="file_id: 22">×</a>
                </div>
            </div>
            </div>

    <!-- Empty message -->
    <div class="upload-empty-message">
        <span class="text-muted">Click or drag files to upload</span>
    </div>

</div>

<!-- Template for new file -->
<script type="text/template" id="uploaderTemplateimageUploader">
    <div class="upload-object dz-preview dz-file-preview">
        <div class="icon-container">
            <img data-dz-thumbnail src="https://xxxxxxxxx.xxx/plugins/responsiv/uploader/assets/images/upload.png" />
        </div>
        <div class="info">
            <h4 class="filename">
                <span data-dz-name></span>
            </h4>
            <p class="size" data-dz-size></p>
            <p class="error"><span data-dz-errormessage></span></p>
        </div>
        <div class="meta">
            <a
                href="javascript:;"
                class="upload-remove-button"
                data-request="imageUploader::onRemoveAttachment"
                data-request-confirm="Are you sure?"
                >&times;</a>
            <div class="progress-bar"><span class="upload-progress" data-dz-uploadprogress></span></div>
        </div>
    </div>
</script>

</form>

Thanks

browser limitation ?

may I know this plugin support which version IE ?
Seem like occur an error on IE9.

SCRIPT438: Object doesn't support property or method 'on'
File: uploader.js, Line: 117, Column: 9

Thanks.

Question: When Using imageUploader inside of custom component, scripts are not appended to page

Uploaders Scripts are not added unless I manually call OnRun from a component reference.
Is this the right thing to do or I´m missing something.

<?php namespace Namespace\Core\Components;

use Cms\Classes\ComponentBase;
use NetSTI\Uploader\Components\ImageUploader;
use RainLab\User\Facades\Auth;
use RainLab\User\Models\User;

/**
 * @property  user
 * @property  imageUploader
 * this component is aliased as 'profile_photos'
 */
class ProfilePhotoUploader extends ComponentBase
{
    private $imageUploader;

    public function componentDetails()
    {
        return [
            'name' => 'ProfilePhotoUploader Component',
            'description' => 'No description provided yet...'
        ];
    }

    /**
     * Returns the logged in user, if available
     */
    public function user()
    {
        if (!Auth::check()) {
            return null;
        }

        return Auth::getUser();
    }

    /**
     *
     */
    public function onRun()
    {
        $this->prepareVars();
        $this->imageUploader->onRun(); // without this, scripts are not added
    }

    /**
     * Executed when this component is initialized
     */
    public function prepareVars()
    {
        $user = $this->user();

        if ($user) {

            /** @var ImageUploader $imageUploader */
            $this->imageUploader = $this->addComponent(
                'NetSTI\Uploader\Components\ImageUploader',
                'imageUploader',
                ['modelClass' => 'RainLab\User\Models\User', 'modelKeyColumn' => 'avatar', 'deferredBinding' => true]
            );

            $this->imageUploader->bindModel('avatar', $user);
            $this->page['user_profile'] = $user;
        }
    }

    public function defineProperties()
    {
        return [

        ];
    }
}

title = "Account"
url = "/account"
layout = "default"

[session]
security = "user"
redirect = "home"

[profile_photos]
==

{% component 'profile_photos' %}

Current user is {{ user.name }}

Multiple instances of components on the same page

Hi,

It will be nice if there was a posibility to create multi instances of ImageUploader/FileUploader on the sam page.

Now the method "bindModel" binds "attribute" so we cannot use "avatar" uploader and for example "movie" uploader on the same page. The first binded attribute is always inserted into system_files table.

I know this plugin is not finished yet, so sorry if you are aware of this problem.

Call to a member function avatar() on null

I'm getting error:

Call to a member function avatar() on null
H:\xampp\htdocs\sacs.org\cms_sacs\oas\plugins\Responsiv\Uploader\traits\ComponentUtils.php line 81

I'm using following code in my component :

    public function init()
    {
        $component = $this->addComponent(
            'Responsiv\Uploader\Components\ImageUploader',
            'imageUploader',
            ['deferredBinding' => false]
        );

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

Ive also tried in Page Init method but its showing same error.

Uploader button not working

I downloaded and set up the uploader plugin but for some reason the button is not working. When i click on it nothing happens. This is my set up.
On the page

[imageUploader]
maxSize = "2"
fileTypes = "*"
deferredBinding = "1"

==

<?php
function onInit()
{
    $this->imageUploader->bindModel('allimage', new Advert);
}
?>`

==

{{ form_open() }}
    <!-- File uploader -->
    {% component 'imageUploader' %}
{{ form_close() }}

Then in my component file

public function onSubmit(){
 $advert = new Advert();
       $advert->title = Input::get('title');
       $advert->user_id = Auth::getUser()->id;
       $advert->save(null, post('_session_key'));
}

In my model i have

  public $attachMany = [
        "allimage" => "System\Models\File"

         ];

The upload button just doesn't respond. What am i missing here?

Using the plugin along with the RainLab.User plugin

I am using the following code to bind the plugin to the files of a logged-in front-end user, and it works. I am wondering if there is a better way to access the user model:

function onInit()
{
    $this->fileUploader->bindModel('catalogs',  $this->account->user());
}

Plugin giving error of class not found

I am getting error of Project class not found.I am beginner with less knowledge of octoercbs plugin.Should i create a new model or use model of User plugin for file upload

Asset combining not working for addCss and addJs using arrays

Version 1.0.5 uses the following in the file uploader component fileUploader.php:

public function onRun()
    {
        $this->addCss(['assets/css/uploader.css']);
        $this->addJs([
            'assets/vendor/dropzone/dropzone.js',
            'assets/js/uploader.js',
        ]);

        $this->autoPopulate();
    }

This uses arrays to pass the asset paths. On my installation , this results in an error:
The source "/plugins/responsiv/uploader/assets/css/uploader.css" is not in the root directory "/home/xxx/public_html/oct".
This is with latest October (465) and version 1.0.5 of file uploader.
Changing just this function back to the 1.0.4 version gets everything working:

    public function onRun()
    {
        $this->addCss('assets/css/uploader.css');
        $this->addJs('assets/vendor/dropzone/dropzone.js');
        $this->addJs('assets/js/uploader.js');

        $this->autoPopulate();
    }

This seems to relate to issue octobercms/october#3264 and following it through in the debugger it seems to be presenting relative paths to the asset combiner not absolute ones, and that breaks it. I guess it's working ok for other people and the docs say using arrays for the assets is fine, but it doesn't work for me. October is installed in the oct folder of the web root. I'm guessing that this might be an October or installation issue rather than a file uploader issue but I haven't been able to find anything that gives me a solution other than changing the code in the onRun function. I have many other downloaded and created plugins that all work fine and it was only when I upgraded the file uploader that it broke.

giving error Class 'Project' not found

Dear sir Thanks for giving this plugin but as i attached it to my project it gives error Class 'Project' not found
i have also create model for this plugin but it did not work.help me urgently required for a project

Model created several times

Hi, I have a strange bug with the uploader plugin.

I have a model : Post with the following file attachment :

public $attachMany = [
    'files' => 'System\Models\File',
];

I have the following code in my html :

{{ form_open({ request: 'onSave' }) }}
  <input type="text" name="title" />
  {% component 'fileUploader' %}
  <button type="submit">Submit</button>
{{ form_close() }}

And here is my onSave function :

function onSave() {
    $post = new Post;
    $post->name = post('title');
    $post->save(null, post('_session_key'));
}

My problem is that, each time I upload a file, a new model is created. Don't know what to do to prevent that and attach all my files to only one model.

Any help would be greatly appreciated, thanks !

Class 'FileUploader' not found

I have tried using the plugin and added FileUploader model class, but still this is not working,
seems the binding is not working properly

Does this plugin works for OctoberCms frontend?

Responsiv Team:

I'm trying to use your uploader plugin, but i'm unable to bind it with a model.
Does this works for frontend? If so, how can I bind it to a model using a simple page?

I would really appreciate your help...

Attribute name must be a string, NULL was passed.

I constantly get the error message:

Attribute name must be a string, NULL was passed. plugins/responsiv/uploader/traits/ComponentUtils.php line 79

In component

use Hambern\Request\Models\Request;

class Form extends ComponentBase
{
    public function init()
    {
        $component = $this->addComponent(
            'Responsiv\Uploader\Components\ImageUploader',
            'imageUploader',
            ['deferredBinding' => true]
        );
        $component->bindModel('pictures', new Request);
    }
...
}

In model

use Model;

class Request extends Model
{
    ...
    public $attachMany = [
        'pictures' => ['System\Models\File'],
        'files'    => ['System\Models\File'],
    ];
}

In partial

{{ form_ajax('Form::onRequest', {
  update: { 'message': '#form_answer' }
}) }}
  <div class="row">
    <div class="twelve columns">
      {% component 'imageUploader' %}
      <button type"submit" class="button">Send »</button>
    </div>
  </div>
{{ form_close() }}

And the imageUploader and the Form component is added to the Layout.

[Form]

[imageUploader]
placeholderText = "Click or drag images to upload"
maxSize = 5
fileTypes = ".gif,.jpg,.jpeg,.png"
imageWidth = 100
imageHeight = 100
imageMode = "crop"

Please help me. If i dump the class ComponentUtils it seems like the bindModel-function is called twice. The first time everything looks correct, but the second time (??) the $attribute is NULL. Why?

Form always renders showing records attached to model with id 0f 1

Trying to use Responsiv\Uploader in a plugin but when the form renders on frontend page it always shows the files attached to the model with id of 1. Everything works in Backend.

Model:

public $attachMany = [
    'forms' => ['System\Models\File'],
];

Component:

public function init() {
    $this->doc = Doc::find(8);

    $component = $this->addComponent(
        'Responsiv\Uploader\Components\FileUploader',
        'fileUploader',
        [
            'placeholderText' => 'Do It',
            'deferredBinding' => false,
            'fileTypes' => 'pdf',
            'maxSize' => '3',
        ]
    );

    $component->bindModel('forms', $this->doc);
}

view:

{{ __SELF__.doc.title }}

{{ form_open() }}

{% component 'fileUploader' %}
{{ form_submit() }}
{{ form_close() }}

Doesn't work with Amazon s3 setup.

  • EDITED -

Okay, it turns out it was working, it just wasn't saving to where i was expecting so I didn't see the uploads.

I think my real question is how do i customize where it uploads to?

mkdir() error on multiple file upload

Hi,

An exception is raised sometimes on multiple image upload :

mkdir() : File Exists

I think it's because we are uploading a public file in the same directory at the same time. Could you help me on that ?

Regards,
Thomas

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.