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.
- Host: GitHub
- URL: https://github.com/krosscode/form-data-size-calculator
- Owner: krosscode
- License: mit
- Created: 2019-05-02T12:04:21.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-02T12:44:01.000Z (almost 6 years ago)
- Last Synced: 2025-01-01T16:37:10.683Z (4 months ago)
- Topics: html, javascript
- Language: JavaScript
- Size: 8.79 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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
- hidden
- month
- number
- password
- radio
- range
- search
- select
- submit
- tel
- text
- textarea
- time
- url
- week