An open API service indexing awesome lists of open source software.

https://github.com/krosscode/form-data-size-calculator

A script for calculating the size of a forms data. Primarily for comparison with PHP's post_max_size.
https://github.com/krosscode/form-data-size-calculator

html javascript

Last synced: 2 months ago
JSON representation

A script for calculating the size of a forms data. Primarily for comparison with PHP's post_max_size.

Awesome Lists containing this project

README

        

# Form data size calculator

This script calculates the size of a forms data. The primary purpose is to make sure that a forms data is smaller than for example PHP's `post_max_size` or Apache's `LimitRequestBody`.

It works by generating a string that emulates php://input as closely as possible.

## Installation

```html

```

## Usage

**HTML**

```html

```

**JS**

```javascript
var form = document.getElementById('form');
var formDataSize = calculateFormDataSize(form);
```

## Support

This does not work with `enctype="multipart/form-data"` as I couldn't find a way to replicate the raw post data when it is active.

Currently these input types are supported:

- button
- checkbox
- color
- date
- datetime-local
- email
- hidden
- month
- number
- password
- radio
- range
- search
- select
- submit
- tel
- text
- textarea
- time
- url
- week