GithubHelp home page GithubHelp logo

silverstripe-dropzone's Introduction

Dropzone for SilverStripe

Upload with sanity.

Introduction

The Dropzone module provides FileAttachmentField, a robust HTML5 uploading interfaces for SilverStripe, allowing forms to save file uploads to DataObject instances.

Features

  • Upload on the frontend, or in the CMS, with one consistent interface
  • Drag-and-drop uploading
  • Automatic client-side thumbnailing
  • Grid view / List view
  • Upload progress
  • Limit file count, file size, file type
  • Permissions for removing/deleting files
  • Tracking files (remove uploaded files that aren't attached to anything)
  • No jQuery dependency

Screenshots

Grid view

List view

Remove/delete files

Beautiful error handling

Any thumbnail size you like

Usage

The field instantiates similarly to UploadField, taking the name of the file relationship and a label, as the first two arguments. Once instantiated, there are many ways to configure the UI.

FileAttachmentField::create('MyFile', 'Upload a file')
  ->setView('grid')

If the form holding the upload field is bound to a record, (i.e. with loadDataFrom()), the upload field will automatically allow multiple files if the relation is a has_many or many_many. If the form is not bound to a record, you can use setMultiple(true).

Image-only uploads can be forced using the imagesOnly() method. If the form is bound to a record, and the relation points to an Image class, this will be automatically set.

More advanced options

FileAttachmentField::create('MyFiles', 'Upload some  files')
  ->setThumbnailHeight(180)
  ->setThumbnailWidth(180)
  ->setAutoProcessQueue(false) // do not upload files until user clicks an upload button
  ->setMaxFilesize(10) // 10 megabytes. Defaults to PHP's upload_max_filesize ini setting
  ->setAcceptedFiles(array('.pdf','.doc','.docx'))
  ->setPermissions(array(
    'delete' => false,
    'detach' => function () {
      return Member::currentUser() && Member::currentUser()->inGroup('editors');
    }
  ));

Image uploads get a few extra options.

FileAttachmentField::create('MyImage','Upload an image')
    ->imagesOnly() // If bound to a record, with a relation to 'Image', this isn't necessary.
    ->setMaxResolution(50000000); // Do not accept images over 5 megapixels

Default settings

Default values for most settings can be found in the config.yml file included with the module.

Usage in the CMS

FileAttachmentField can be used as a replacement for UploadField in the CMS.

Interacting with the Dropzone interface programatically

For custom integrations, you may want to access the UploadInterface object that manages the upload UI (see file_attachment_field.js). You can do that one of two ways:

  • If you have jQuery installed, simply access the dropzoneInterface data property of the .dropzone element
$('#MyFileDropzone').data('dropzoneInterface').clear();
  • If you are not using jQuery, the UploadInterface object is injected into the browser global window.dropzones, indexed by the id of your .dropzone element.
window.dropzones.MyFileDropzone.clear();

NB: The ID of the actual .dropzone element by default is the name of the form input, with 'Dropzone' appended to it, so FileAttachmentField::create('MyFile') creates a dropzone with an ID of 'MyFileDropzone'

Tracking / removing unused file uploads

FileAttachmentField::create('MyImage','Upload an image')
    ->setTrackFiles(true)

or:

FileAttachmentField:
  track_files: true

To stop users from uploading lots of files and filling the servers hard-drive via the frontend, you can track each file upload in a record, which is then removed when a form saves using Form::saveInto($record).

If you do not use Form::saveInto, you will need to manually untrack the file IDs with:

FileAttachmentFieldTrack::untrack($data['MyImageID']);

To action the deletion of all the tracked files, you can run the FileAttachmentFieldCleanTask.

Troubleshooting

Ring Uncle Cheese.

silverstripe-dropzone's People

Contributors

anselmdk avatar cjsewell avatar digitall-it avatar doniz avatar hailwood avatar hdpero avatar jamesdpc avatar kinglozzer avatar lekoala avatar martimiz avatar maxime-rainville avatar muskie9 avatar nimeso avatar silbinarywolf avatar undefinedoffset avatar wilr avatar yvestrublin 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

Watchers

 avatar  avatar  avatar  avatar  avatar

silverstripe-dropzone's Issues

The javascript fails with recursion error message

The javascript fails with recursion calls to add, error, & remove functions of the dropzone JS. In the end, it stops with the following error. “Uncaught RangeError: Maximum call stack size exceeded”.

To replicate:

  • Create field with the option multiple set to false.
  • Drag and drop multiple files.
  • After few sections, you will see the error message in Chrome console.

If you register a callback on the events (addedfile, removedfile, & error) you will see these are called repeatedly.

The issue is within these lines: https://github.com/unclecheese/silverstripe-dropzone/blob/master/javascript/file_attachment_field.js#L76-L81
The event called for each of the rejected files but also adds the rejected file back to the dropzone.

IE9 Bug: classList does not exist

Need to either polyfill or use archaic methods of class detection here. (And possibly in other places)

file_attachment_field.js

if(this.node.classList.contains('uploadable')) {
this.backend = new backend(this.node, this.settings);
}

Translatiosn

I might be missing something but I was wondering how I can translate strings defined in JS? For example I need to translate the "File is too big ({{filesize}}MiB). Max filesize: {{maxFilesize}}MiB." string. Is there any way to do this?

Feature: Alias UploadField methods

I noticed the ReadMe states:

FileAttachmentField can be used as a replacement for UploadField in the CMS.

But when I swapped out the class I got a couple of errors because this no longer worked:

$uploadField->setAllowedFileCategories('image');
$uploadField->setAllowedMaxFileNumber(1);

Just wondered if it would be easy to alias these function names and redirect them to the equivalent method on FileAttachmentField?

bug? revertDeletion not removing <input class="input-deleted-file"...

Hi Aaron,
I reeeally like this module, and where it's going! Many thanks for your efforts.

I am using your module from the frontend, where delete isn't enabled by default, but still... This seems to be a small bug:

file_attachment_field.js -> revertDelete() uses getHolder() to remove the <input class="input-deleted-file"...> , but that seems tp point to the wrong holder '.attached-file-inputs' (should be '.attached-file-deletions'). The following test seems to fix this:

revertDeletion: function () {
    //var del = this.getHolder().querySelector('input.input-deleted-file[value="'+this.getIdentifier()+'"]');

    var holder = this.uploader.node.querySelector('.attached-file-deletions');
    var del = holder.querySelector('input.input-deleted-file[value="'+this.getIdentifier()+'"]');

    if(del) {   
        ...

Martine

Possible bug with filenames?

This issue might not be a problem with this module, but I figured I'd ask anyway.

I am using dropzone in a frontend form. This form is used for job applications where people upload their CV, picture etc. This information/files is than saved onto a JobApplication dataobject, which has some normal fields, and a many many relation to File. There is also send an Email with these files attached.

It seems to be working fine most of the time, until the client reported an issue where some applications had a relation to a file, which did not belong to them. This problem arose where the filenames were very generic i.e. "CV" or so, so that they were renamed to something like "CV1".

The question: Could there be an issue files being overwritten if they are uploaded at the same time or something?

I save the data like this:

        $object = JobApplication::create();
        foreach ($data['Attachments'] as $file) {
            $file_object = File::get()->byID($file); // $file is just ID
            $folder = Folder::find_or_make('jobs/applications');
            $object->Attachments()->add($file);
            if ($folder) {
                $file_object->setParentID($folder->ID);
            }
            $file_object->write();
        }
        $form->saveInto($object);

I do the foreach because I need to move the files attached to the object, to another folder. WHen files are first uploaded, they end up in a "temp" folder.

max upload size is misreported

The upload size is reported from php post_max_size and upload_max_filesize and recalculated into bytes. But the recalculation is wrong, get_filesize_from_ini uses 1000 instead of 1024.

Suggested fix:
return floor($bytes/(1024*1024))

Does not work with Translatable module

I modified file_attachment_field_backend.js to preserve URL parameters.
line 9:
var iParams = config['urlSelectDialog'].indexOf('?'),
iframeUrl = config['urlSelectDialog'].substr(0, iParams),
iframeParams = config['urlSelectDialog'].substr(iParams+1);

line 18:
dialog.ssdialog({iframeUrl: iframeUrl + '?' + iframeParams, height: 550});

and line 35:
$.ajax({
url: iframeUrl+'/filesbyid?ids='+ids.join(',') + '&' + iframeParams,

FileAttachmentField Template Not Being Loaded

Here's an odd one. Added a FileAttachmentField to my form, but it only loads using the FileField template:

However, if I rename FileAttachementField_holder.ss to FileAttachementField.ss it loads fine.

Any idea what could be causing this?

The inputs in `.attached-file-inputs` aren't being dynamically created when adding a new image on the front end

Hi @unclecheese ,

Thanks for this module. It's great.

I've encountered an error while using it on a fronted form. I've dragged an image onto the dropzone and it looks ok, but when I look at the code there is no input in div.attached-file-inputs. So when I save the form, the file ID isn't saved into my model. Any ideas why this might be?

I don't have any javascript errors. I am including "/dropzone/javascript/file_attachment_field.js" and "/dropzone/javascript/dropzone.js" and they are loading fine. The CSS is loading in fine too.

I'm adding the field in the form as follows:

$fields = FieldList::create();
$fields->push(
    FileAttachmentField::create('Logo', _t('Agency.has_one_Logo'))
);
return $fields;

Do you need any more information from me?

callback on Image is completely uploaded

Dear Uncle Cheese,

I made a silverstripe Module called cropfield. Its adding the functionallity of JCrop to dropzone for uploading (profile)pictures in frontend.
In cropfield.js I am using
$('#Dropzone').data('dropzoneInterface').backend.on('complete',function(){...}
(I also tried success instead of complete).
I need to get the size of the original uploaded Image. I do this with:

var pic_real_width = document.querySelector('#cropArea').naturalWidth;
var pic_real_height = document.querySelector('#cropArea').naturalHeight;

But to get the real Values I do have to set a timeout, because when I dont't I allways get 0.
I need a callback function that triggers when the Image is completly uploaded and added to Dom so I can get the real Values for width and height and get rid of the timeout.

You can find my code here:
[https://github.com/TheTigerDuck/silverstripe-cropfield]

By the Way
Thanks for all your awesome work on silverstripe and excuse my bad english.

I can't handle sub-URLs of a Form object.

Sorry, 2nd issue: Upon attempting to upload any file, it just says:

OH NO!
I can't handle sub-URLs of a Form object.

Just using FileAttachmentField::create('Image', 'Logo for brick') in a simple Form.

Image not selected after save

I'm having problems with FileAttachmentField. When uploading an image, the image is uploaded, but when I publish the page, the image is no longer selected/visible in the FileAttachmentField control. I have to click on "choose from existing files" and select the image again and then republish the page. Which usually works, but sometimes the image is gone again, after the save.

Is anyone else seeing this behavior?

Javascript error when SSViewer:source_file_comments = true

SSViewer:source_file_comments = true causes Uncaught TypeError: file.previewElement.querySelectorAll is not a function when uploading a file. May just be a case of turning SSViewer:source_file_comments off when rendering templates for this field

Can not detach the last file from a FileAttachmentField

I think commit d2944d8 has introduced a new problem.

If your FileAttachmentField has one or many existing files associated with it and you try to detach all those files, the change doesn't register. You can detach files as long as you leave at least one.

I think the problem is that if you detach all the files in your FileAttachmentField, there's no value at all sent back to the server for the field.

So when you hit the following condition on line 213, it will not update the relation:

if(($relation = $this->getRelation()) && is_array($this->Value())) {
    $relation->setByIDList($this->Value());
} elseif($record->has_one($fieldname)) {
...

I tried removing && is_array($this->Value() on my local version and I was able to detach all file attachments again.

Files uploaded in front end form do not attach to dataobject.

This plugin is really great, but I have noticed that if included on a front end form that does not directly link into a dataobject, the files get uploaded but do not get attached to the correct dataobject.

So, the form is pretty basic, all working and submitting, except for the file uploads.

here is the submission code:

public function doOrderForm($data, $form) {

    $submission = new OrderSubmission();

    $form->saveInto($submission);

    $submission->write();

    if(isset($config->newsletterMessage)){
        $customMessage = $config->newsletterMessage;
        $this->setMessage('Success', $customMessage);
    }else{
        $this->setMessage('Success', 'Thank you for your submission');
    }

    return $this->redirectBack();

}

The form submits into a managed dataobject called "Submissions". the normal Upload Field does this fine, but has no nice interface for drag and dropping the files.

However, the minute that I switch to a FileAttachmentField, the file is submitted but no connection is made to the dataobject many_many.

Thoughts? I would love to use this, but I can't if it doesn't have the right relations.

Issue with tmp folder maybe?

Hi ya!

Thanks for all your hard work man!
I'm having issues... I also can't see the file in my wamp/tmp folder? hmmmm... what am I doing wrong? I get the following error displaying

MapPage.php:90 - MapPage_Controller::doCreatePOIImageForm()

SS_HTTPRequest Object
(
[url:protected] => new-map-page/doCreatePOIImageForm/field/Image/upload
[dirParts:protected] => Array
(
[0] => field
[1] => Image
[2] => upload
)

[extension:protected] =&gt; 
[httpMethod:protected] =&gt; POST
[getVars:protected] =&gt; Array
    (
        [url] =&gt; /new-map-page/doCreatePOIImageForm/field/Image/upload
    )

[postVars:protected] =&gt; Array
    (
        [SecurityID] =&gt; 09cc762167db58637a614769c6279a352f4e1545
        [file] =&gt; Array
            (
                [name] =&gt; Koala.jpg
                [type] =&gt; image/jpeg
                [tmp_name] =&gt; D:\wamp\tmp\php5E97.tmp
                [error] =&gt; 0
                [size] =&gt; 780831
            )

    )

[headers:protected] =&gt; Array
    (
        [Mod-Rewrite] =&gt; On
        [Host] =&gt; skyline.nimeso
        [Connection] =&gt; keep-alive
        [Origin] =&gt; http://skyline.nimeso
        [User-Agent] =&gt; Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36
        [Accept] =&gt; application/json
        [Cache-Control] =&gt; no-cache
        [X-Requested-With] =&gt; XMLHttpRequest
        [Referer] =&gt; http://skyline.nimeso/new-map-page
        [Accept-Encoding] =&gt; gzip, deflate
        [Accept-Language] =&gt; en-US,en;q=0.8,it;q=0.6
        [Cookie] =&gt; PHPSESSID=6stc352ul7jjd2n3dfq41876k1; bypassStaticCache=1; cms-panel-collapsed-cms-content-tools-CMSPagesController=true; cms-panel-collapsed-cms-content-tools-CMSMain=false; cms-panel-collapsed-cms-menu=false; PastMember=1
        [Content-Type] =&gt; multipart/form-data; boundary=----WebKitFormBoundaryrSiXuxDvmarBFHr2
        [Content-Length] =&gt; 781151
    )

[body:protected] =&gt; 
[allParams:protected] =&gt; Array
    (
        [URLSegment] =&gt; new-map-page
        [Action] =&gt; doCreatePOIImageForm
        [ID] =&gt; field
        [OtherID] =&gt; Image
    )

[latestParams:protected] =&gt; Array
    (
        [Action] =&gt; doCreatePOIImageForm
        [ID] =&gt; field
        [OtherID] =&gt; Image
    )

[routeParams:protected] =&gt; Array
    (
        [Controller] =&gt; ModelAsController
    )

[unshiftedButParsedParts:protected] =&gt; 2

)

How to attach existing images to edit form frontend

all images saved in add form: $EstateImages = EstateImage::get()->filter(array('EstateID' => $EstateID ));

formfield: $fields->push(FileAttachmentField::create('EstateImages', 'Nuotraukos')->sortable()->setSortableColumn('SortOrder')->setFolderName('/estates_images/' . date('Ymd') . "_" . Member::currentUserID())->setMultiple(true)->setView('grid')->setAutoProcessQueue(true));

how to attach to this form field? please help

Editing Image fields after upload

What would be the best way to give a user the ability to edit the Title field on Image, after it has been uploaded?

I've got a use case where users upload images in a form, and then be able to set a caption for each image. Then the form is submitted.

Not sure if this module out of the box can easily let me build such functionality.

missing docx icon

The 16px file icon for docx is present but is not for any other size.

Rendering with custom Template fails

I'm using FileAttachmentField on a frontend . When a form is called with
$form->setTemplate('MyCustomtemplate');
FileAttachmentField is not rendered (only the Browse button is displayed as for single file)

Tried renaming template to remove "_holder" bit , but it then complains that my browser does not support HTML5 .

Frontend is Bootstrap based, however removing all css/js does not help :(

My form template below:

<form $FormAttributes>
    <% if $Message %>
    <h4 id="{$FormName}_error" class="message $MessageType">$Message</h4>
    <% else %>
    <h4 id="{$FormName}_error" class="message $MessageType" style="display: none"></h4>
    <% end_if %>


    <fieldset class="">
       <div class="col-md-6">
                    <h3>Test Upload</h3>
                      <div class="field fileattachment supportedt" id="Failai">
                        <label for="changeProfileForm_ProfileForm_Slapyvardis" class="">Upload files</label>
                        <div class="middleColumn">
                            $Fields.dataFieldByName(Failai)
                        </div>
                        <span id="{$FormName}_error" class="message $Fields.dataFieldByName(Failai).MessageType">
                            $Fields.dataFieldByName(Failai).Message
                        </span>
                    </div>

       </div>

        $Fields.dataFieldByName(SecurityID)
    </fieldset>
    <% if $Actions %>
    <div class="Actions">
        <% loop $Actions %>$Field<% end_loop %>
    </div>
    <% end_if %>
</form>

validate and getValidFileIDs

The validate method checks for validIDs which is a good thing, but relies on something set in the session. So, if you have a form with let's say Pictures, they are not going to be valid next time you visit the same form (at least, on my setup).

This is why I had to do something like that

$uploader->addValidFileIDs($this->dataobject->Pictures()->column('ID'));

To make it work, instead on relying on loadDataFrom to setValue and make sure the loaded files are valid.

Is this the expected use? having to call addValidFileIDs manually seems more work that it needs to.

Problems using on a pagetype in the CMS

I've had trouble using this on a pretty clean backend using the 3.1.x-dev versions of both cms and framework.

See screenshots.

This happened when I first installed it:

screenshot 2015-05-27 10 25 49

After a little debugging I tried renaming FileAttachmentField_holder.ss to FileAttachmentField.ss, which made it look a lot better:

screenshot 2015-05-27 10 25 01

Still no joy though, as uploaded images are not being saved, and there's no "upload" button.

This is my getcms method:

/**
 * @return FieldList
 */
public function getCMSFields() {
    $fields = parent::getCMSFields();
    $fields->removeByName('Content');
    $fields->addFieldsToTab(
        'Root.Main',
        [
            FileAttachmentField::create('Image1', 'Top Image')
                ->setView('grid')
                ->setFolderName(self::UPLOAD_FOLDER)
                ->setAutoProcessQueue(true)
                ->imagesOnly()
            ,
            FileAttachmentField::create('Image2', 'About Image')
                ->setView('grid')
                ->setFolderName(self::UPLOAD_FOLDER)
                ->imagesOnly()
        ]
    );
    return $fields;
}

You see I also tried experimenting with setAutoProcessQueue(true).

Am I missing anything?

404 error on front-end on 'upload' action

  1. I am creating a new DataObject (It does not exist yet) on the front-end using a form
  2. The data object has_one ListingImage that I'm using dropzone for
  3. I drag my image file in and I get the progress bar and prefly see the thumbnail
  4. My network console says its trying POST to http://mysite/profile/CreateListingForm/field/ListingImage/upload but it returns a 404
  5. I have tried adding 'upload' to my $allowed_actions with no luck :(

Could this be because the DataObject has not been created yet? What am I doing wrong?

Hackable

I was successfully able to submit a raw file POST request and upload a php file to the assets folder using an HTTP client. Thankfully SilverStripe won't allow that directory to run executable scripts. Class FileAttachmentField does not set allowed extensions on the Upload_Validator so the validator has an empty array of extensions, and therefore does not validate the file extension. You must call $this->setAllowedExtensions() in your FileAddachmentField::setAcceptedFiles() method to validate extensions from a forced POST that is not JavaScript validated.

Trying to use inside Ajax loaded html

More of a feature maybe ;)

I'm trying to get this working if I'm requesting HTML via ajax.
I've Required all the needed js and css files inside my Page_Controller but still no luck.
I'm not the best with ajax so I might be missing something?

Thanks bro! Love the module

Proper Handling of Validation messages

FileAttachmentField.php should show the validation exception message provided with something like the following.

try {
    $this->upload->loadIntoFile($tmpFile, $fileObject, $this->getFolderName());
    $ids[] = $fileObject->ID;
} catch (ValidationException $e) {
  return $this->httpError(400, $e->getMessage());
} catch (Exception $e) {
  $error_message = _t('FileAttachmentField.GENERALUPLOADERROR', 'Sorry, the file could not be saved at the current time, please try again later.');
  return $this->httpError(400, $error_message);
}

Unknown function getdisplayfoldername

Not sure where it has come from, but when trying to select files from the cms we are getting a call to unknown function getdisplayfoldername.

This extension below fixes it for me but we might want to add the function to FileAttachmentField.

class FileAttachmentFieldExtension extends Extension {

    private static $allowed_actions = [
        'getdisplayfoldername'
    ];

    public function getdisplayfoldername() {
        return $this->owner->getFolderName();
    }
}

Multiple Dropzone's for same field name cause conflicts

I have discovered an issue for my particular use case. I am using Dropzone to allow the attachment of files to comments, both replies and root comments.

However, when rendering to the DOM the same ID is used (as it's mapped to the field name). This therefore causes all Dropzones to fire when clicking on any of the Dropzones and forces all files added to only appear in the Dropzone that appears first in the HTML order.

I have a "fix" for this, which is to generate and add a unique hash to the ID, by adding a getUniqueID method to the FileAttachmentField class and then consume this within the templates. The fix has resolved my issue but I wonder whether you can advise if this a problem you'd accept a PR for or whether I've missed something; I'm pretty new to Silverstripe.

setMultiple(true) doesn't work

function setUploadMultiple doesn't exist

public function setMultiple($bool) {
$this->settings['uploadMultiple'] = $bool;
return $this;
//return $this->setUploadMultiple($bool);
}

[Question] PHP version compatible

I use this module for my project, it runs well. But when I install on customer's host, I got the error:

Fatal error: Can't use method return value in write context in /home/***/dropzone/code/FileAttachmentField.php on line 785

I noticed that, the hosting is running with php 5.4.45, and my localhost is running in php 5.5 and above.

So, is it true that this module only compatible with php version >= 5.5 ?

Translation in PHP

Hi,
Theres "You can also" bit of text left without tranlation in FileAttachmentField_holder.ss ( YOUCANALSO - not in the yml file)

Cheers

Wrong classname when upload images in frontend

When I upload an image in the frontend the classname for the saved image is set as "file" in the database
In the modeladmin the image is saved as "image" in the database (as expected)

// Dataobject
private static $has_one = array(
'Picture' => 'Image'
);

// Form controller
FileAttachmentField::create('Picture', 'Picture')->setView('grid')

Feature: Limit image resolution

How did I miss this module getting released? Looks amazing!

I just have a feature request, don't know if this is even possible but it would be great if there was a setMaxResolution($totalPixels) validation option to prevent users uploading high resolution images.

GD can easily crash when trying to resize high resolution images, and the problem has nothing to do with filesize and everything to do with the number of pixels in the image. So a 5kb PNG could cause a crash just as easily as a 5mb JPEG.

@kinglozzer developed a fix to prevent this crash happening more than once for a particular image, but client-side validation could go a long way towards preventing a crash ever happening in the first place.

Thanks for another great looking module, looking forward to trying it out.

Resample image on upload

Hi!

Sure looking awesome, this module! However we just got used to the auto-resample-if-above-certain-dimensions-feature from heyday/silverstripe-optimisedimage and that doesn't work anymore when using dropzone.

So... would it be a nice feature to add to dropzone. That provides users with the best UX as they don't have to resize images themselves. What do you think?

Reseting/destroying uploaded images using javascript/jquery

I'm sending my form data via ajax and I need to reset/remove any uploaded images from the dropzone after the form has been submitted. So far I have:

$(".input-attached-file").remove();
$(".file-attachment-field-previews li").remove();
$("#ImageDropzone").removeClass("dz-max-files-reached");

But the dz-max-files-reached class keeps coming back... I get the following error in the dropzone thumbnail 'OH NO! You can not upload any more files.'

Small thingies...

Hi Aaron,
Me again :) Some small thingies:

  1. add_remove_links (config) doesn't seem to do anything?
  2. delete adds an <input class="input-deleted-file" but remove (unattach) does no such thing. Is that by design or would it be an idea to add it?

Thanks again, Martine

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.