uploads

go
package files

import (
  "context"
  "time"

Presigned S3 upload URLs (AWS SDK v2)

go aws s3
by Leah Thompson 1 tab
go
package api

import (
  "io"
  "net/http"
  "os"

Safe multipart uploads using temp files (bounded memory)

go http uploads
by Leah Thompson 1 tab
erb
<div id="image_preview">
  <%= render 'images/preview', record: @profile %>
</div>

Preview Active Storage uploads after attach using Turbo Streams

rails hotwire turbo
by Henry Kim 3 tabs
go
package api

import (
  "io"
  "net/http"
)

Content sniffing for uploads (don't trust the header)

go http uploads
by Leah Thompson 1 tab
python
from django.core.exceptions import ValidationError


def validate_file_size(file):
    """Limit file size to 5MB."""
    max_size_mb = 5

Django file upload handling with validation

django python files
by Priya Sharma 2 tabs
ruby
class User < ApplicationRecord
  has_one_attached :avatar do |attachable|
    attachable.variant :thumb,
      resize_to_limit: [256, 256],
      convert: :webp,
      saver: { quality: 80 }

Attach and Resize an Avatar with an Active Storage Variant in Rails

rails active-storage image-processing
by codesnips 3 tabs
go
package httpx

import (
	"net/http"
	"strconv"
)

Enforce a Maximum Request Body Size in Go HTTP Handlers with MaxBytesReader

http middleware security
by codesnips 3 tabs
python
import enum
import datetime as dt

from sqlalchemy import Column, Integer, String, BigInteger, Enum, DateTime
from sqlalchemy.orm import declarative_base

Streaming FastAPI File Uploads with a Background Validation Task

fastapi uploads background-tasks
by codesnips 3 tabs