Skip to main content

Django File Upload Handler

An Easy Way To Upload Files To Django

✨ Features

  • Upload Any File With Any Size In Any Format
  • Saves Files Secure and Denied Foreign Requests
  • Simple Import and Usage
  • Host Files Safely With Simple Key

📦 Install

$ pip3 install djfiler

🔨 Usage

# Import Django Filer
from djfiler import djfiler

# Initial Django Filer
djs = djfiler.Filer('/dir/of/uploades', True)

''' djs can be any name you like '''

Handle Upload Files In Any Format

def home(request):
    if request.method == "POST":
        callback = djs.upload(file=request.FILES['file name uploaded'], name="Optional" )
        print(callback) # Its Returns {status:ok | fail,name: name of file ( Its Key Of File ),type: type of file }

Return Any File With A Simple Key (Key Is The String That We Return To You When Uploaded file)

urls.py

 path('images/<slug:key>', sendfile)

 ''' path name can be anything you like we just need the key parameters '''

views.py

def sendfile(request, key):
    callback = djs.find(key)
    if callback != None:
        data = json.loads(callback)
        if data['find']:
            with open(data['uri'], "rb") as f:
                return HttpResponse(f.read(), content_type='*/*')
        else:
            return HttpResponse('ERROR TO SEND FILE')
    else:
        return HttpResponse('File Not Found')

Thats All

Metadata

Release files for djfiler 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for djfiler 0.1
File Interpreter ABI Platform Actions
djfiler-0.1-py3-none-any.whl Python 3 none any Details for djfiler-0.1-py3-none-any.whl

Release files / djfiler-0.1-py3-none-any.whl

Download URL djfiler-0.1-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8c7f7cca3ad165101081b3d5d51cfa282996797042835b368edcdb6a2f9b072e
BLAKE2b-256 checksum
How to use checksums
a1f7a79c3c47a2ffab3cf116587bb692b423f47fd0e893f582b84006f037eeb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.33.0 CPython/3.7.4

Security for djfiler 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page