
Research
/Security News
11 Malicious Go Packages Distribute Obfuscated Remote Payloads
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
DroppableFileInput is a custom Django widget that enhances the usability of file input forms by allowing users to drag and drop files. This widget utilizes JavaScript to provide interactive feedback, such as highlighting the drop area when a file is dragged over and displaying file details on the page.
DroppableFileInput is a custom Django widget that enhances the usability of file input forms by allowing users to drag and drop files. This widget utilizes JavaScript to provide interactive feedback, such as highlighting the drop area when a file is dragged over and displaying file details on the page. This uses no external JavaScript dependencies, all functionality is brought by this package.
To install DroppableFileInput, you can download it directly from GitHub or use pip:
pip install git+https://github.com/blackbox-innovation/django-droppablefileinput.git
After installation, add droppablefileinput
to your INSTALLED_APPS
in your Django settings:
INSTALLED_APPS = [
...
'droppablefileinput',
...
]
Ensure you have Django's static file handling set up, as this widget relies on associated CSS and JavaScript files.
To use the DroppableFileInput
in your Django forms, import the widget and use it in a form field:
from django import forms
from droppablefileinput.widgets import DroppableFileInput
class UploadForm(forms.Form):
file = forms.FileField(widget=DroppableFileInput())
In your templates, make sure to include the form's media:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Upload File</title>
{{ form.media }}
</head>
<body>
<form method="post" enctype="multipart/form-data">
{% csrf_token %} {{ form.as_p }}
<button type="submit">Upload</button>
</form>
</body>
</html>
The DroppableFileInput
widget can be customized with the following parameters:
auto_submit
: Whether to auto-submit the form upon file selection.max_file_size
: Maximum file size allowed for upload.allowed_types
: List of allowed file MIME types.icon_url
: URL to the icon image to display in the drop area.icon_width
: Width of the icon image.icon_height
: Height of the icon image.Example:
class UploadForm(forms.Form):
file = forms.FileField(widget=DroppableFileInput(
auto_submit=True,
max_file_size="10M",
allowed_types="image/jpeg,image/png",
icon_url=static('images/custom-icon.svg'),
icon_width=40,
icon_height=40
))
Contributions are welcome! If you would like to contribute to this project, please follow these steps:
Distributed under the MIT License. See LICENSE
file for more information.
If you have any issues or feature requests, please file an issue on the GitHub repository issue tracker.
FAQs
DroppableFileInput is a custom Django widget that enhances the usability of file input forms by allowing users to drag and drop files. This widget utilizes JavaScript to provide interactive feedback, such as highlighting the drop area when a file is dragged over and displaying file details on the page.
We found that droppablefileinput demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
Socket uncovered 11 malicious Go packages using obfuscated loaders to fetch and execute second-stage payloads via C2 domains.
Security News
TC39 advances 11 JavaScript proposals, with two moving to Stage 4, bringing better math, binary APIs, and more features one step closer to the ECMAScript spec.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).