dianping/cat · error · Error
No URL provided.
Error message
No URL provided.
What it means
After merging options, Dropzone needs an upload endpoint: it takes options.url, and if that is null falls back to the element's action attribute. If neither yields a URL, it throws 'No URL provided.' because every upload would fail without a destination.
Source
Thrown at cat-home/src/main/webapp/assets/js/uncompressed/dropzone.js:595
}
if (!(this.element && (this.element.nodeType != null))) {
throw new Error("Invalid dropzone element.");
}
if (this.element.dropzone) {
throw new Error("Dropzone already attached.");
}
Dropzone.instances.push(this);
this.element.dropzone = this;
elementOptions = (_ref = Dropzone.optionsForElement(this.element)) != null ? _ref : {};
this.options = extend({}, this.defaultOptions, elementOptions, options != null ? options : {});
if (this.options.forceFallback || !Dropzone.isBrowserSupported()) {
return this.options.fallback.call(this);
}
if (this.options.url == null) {
this.options.url = this.element.getAttribute("action");
}
if (!this.options.url) {
throw new Error("No URL provided.");
}
if (this.options.acceptedFiles && this.options.acceptedMimeTypes) {
throw new Error("You can't provide both 'acceptedFiles' and 'acceptedMimeTypes'. 'acceptedMimeTypes' is deprecated.");
}
if (this.options.acceptedMimeTypes) {
this.options.acceptedFiles = this.options.acceptedMimeTypes;
delete this.options.acceptedMimeTypes;
}
this.options.method = this.options.method.toUpperCase();
if ((fallback = this.getExistingFallback()) && fallback.parentNode) {
fallback.parentNode.removeChild(fallback);
}
if (this.options.previewsContainer !== false) {
if (this.options.previewsContainer) {
this.previewsContainer = Dropzone.getElement(this.options.previewsContainer, "previewsContainer");
} else {
this.previewsContainer = this.element;
}View on GitHub (pinned to e815e74d4c)
Solutions
- Always pass url explicitly: new Dropzone(el, { url: '/file/upload' }).
- Or use a <form class="dropzone" action="/upload"> so the action fallback works.
- Check for typos in the url option key and that it is not overridden to a falsey value.
Example fix
// before
new Dropzone('#dropzone-div'); // div has no action attr
// after
new Dropzone('#dropzone-div', { url: '/file/upload' }); Defensive patterns
Strategy: validation
Validate before calling
var url = opts.url || (el.getAttribute && el.getAttribute('action')) || DEFAULT_UPLOAD_URL;
if (!url) throw new Error('Upload URL not configured for #'+el.id);
new Dropzone(el, $.extend({}, opts, { url: url })); Prevention
- Always pass url explicitly in the options object instead of relying on the form action fallback.
- If using the action attribute, make sure the element is a <form action="/...">.
- Centralize upload endpoints in one config constant to avoid empty strings.
When it happens
Trigger: new Dropzone('#form') on a <div class="dropzone"> (divs have no action attribute) without passing url; passing a form whose action attribute is empty or missing; options.url set to undefined by a typo'd key (urls: '/upload').
Common situations: Using a div.dropzone container styled with CSS but forgetting the url option; forms rendered without action (relying on JS submit); copying example markup that used a <form action="/upload"> while switching to a div.
Related errors
- You can't provide both 'acceptedFiles' and 'acceptedMimeType
- This file can't be queued because it has already been proces
- Invalid date format.
- Must choose at least one picker
- failed to require "{name}"
AI-assisted analysis of dianping/cat@e815e74d4c (2026-08-14).
Data as JSON: /api/errors/b2d9c1732e968849.
Report an issue: GitHub.