Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Dead simple drop-in multi file upload field for django forms using HTML5's multiple attribute.
Dead simple drop-in multi file upload field for django forms using HTML5's multiple
attribute.
$ pip install django-multiupload
$ pip install -e git+https://github.com/Chive/django-multiupload.git#egg=multiupload
Add the form field to your form and make sure to save the uploaded files in the form's save
method.
For more detailed examples visit the examples section.
# forms.py
from django import forms
from multiupload.fields import MultiFileField, MultiMediaField, MultiImageField
class UploadForm(forms.Form):
attachments = MultiFileField(min_num=1, max_num=3, max_file_size=1024*1024*5)
# If you need to upload media files, you can use this:
attachments = MultiMediaField(
min_num=1,
max_num=3,
max_file_size=1024*1024*5,
media_type='video' # 'audio', 'video' or 'image'
)
# For images (requires Pillow for validation):
attachments = MultiImageField(min_num=1, max_num=3, max_file_size=1024*1024*5)
The latter two options just add fancy attributes to HTML's <input>
, restricting the scope to corresponding filetypes.
# models.py
from django.db import models
class Attachment(models.Model):
file = models.FileField(upload_to='attachments')
# views.py
from django.views.generic.edit import FormView
from .forms import UploadForm
from .models import Attachment
class UploadView(FormView):
template_name = 'form.html'
form_class = UploadForm
success_url = '/done/'
def form_valid(self, form):
for each in form.cleaned_data['attachments']:
Attachment.objects.create(file=each)
return super(UploadView, self).form_valid(form)
FAQs
Dead simple drop-in multi file upload field for django forms using HTML5's multiple attribute.
We found that django-multiupload 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.