{"id":16373237,"url":"https://github.com/bbqsrc/actix-form-data","last_synced_at":"2025-10-03T20:19:11.458Z","repository":{"id":66192566,"uuid":"197582770","full_name":"bbqsrc/actix-form-data","owner":"bbqsrc","description":null,"archived":false,"fork":false,"pushed_at":"2019-07-18T12:30:04.000Z","size":381,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-06-01T14:48:06.534Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bbqsrc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["bbqsrc"],"custom":"https://necessary.nu"}},"created_at":"2019-07-18T12:29:00.000Z","updated_at":"2025-02-20T09:20:35.000Z","dependencies_parsed_at":"2023-02-25T06:45:54.982Z","dependency_job_id":null,"html_url":"https://github.com/bbqsrc/actix-form-data","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bbqsrc/actix-form-data","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbqsrc%2Factix-form-data","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbqsrc%2Factix-form-data/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbqsrc%2Factix-form-data/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbqsrc%2Factix-form-data/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bbqsrc","download_url":"https://codeload.github.com/bbqsrc/actix-form-data/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bbqsrc%2Factix-form-data/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278220480,"owners_count":25950475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-03T02:00:06.070Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-11T03:13:46.682Z","updated_at":"2025-10-03T20:19:11.412Z","avatar_url":"https://github.com/bbqsrc.png","language":"Rust","readme":"# Actix Form Data\nA library for retrieving form data from Actix Web's multipart streams. It can stream uploaded files\nonto the filesystem (its main purpose), but it can also parse associated form data.\n\n[documentation](https://docs.rs/actix-form-data)\n\n### Usage\n\nAdd it to your dependencies.\n```toml\n# Cargo.toml\n\n[dependencies]\nactix-web = \"1.0.0-beta.3\"\nactix-multipart = \"0.1.0-beta.1\"\nactix-form-data = \"0.4.0-beta.2\"\n```\n\nRequire it in your project.\n```rust\n// src/lib.rs or src/main.rs\n\nuse form_data::{Field, Form, Value};\n```\n\n#### Overview\nFirst, you'd create a form structure you want to parse from the multipart stream.\n```rust\nlet form = Form::new().field(\"field-name\", Field::text());\n```\nThis creates a form with one required field named \"field-name\" that will be parsed as text.\n\nThen, pass it to `handle_multipart` in your request handler.\n```rust\nfn request_handler(mp: Multipart, state: Data\u003cState\u003e) -\u003e ... {\n    let future = form_data::handle_multipart(mp, state.form);\n\n    ...\n}\n```\n\nThis returns a `Future\u003cItem = Value, Error = form_data::Error\u003e`, which can be used to\nfetch your data.\n\n```rust\nlet field_value = match value {\n    Value::Map(mut hashmap) =\u003e {\n        hashmap.remove(\"field-name\")?\n    }\n    _ =\u003e return None,\n};\n```\n\n#### Example\n```rust\n/// examples/simple.rs\n\nuse std::path::PathBuf;\n\nuse actix_multipart::Multipart;\nuse actix_web::{\n    web::{post, resource, Data},\n    App, HttpResponse, HttpServer,\n};\nuse form_data::{handle_multipart, Error, Field, FilenameGenerator, Form};\nuse futures::Future;\n\nstruct Gen;\n\nimpl FilenameGenerator for Gen {\n    fn next_filename(\u0026self, _: \u0026mime::Mime) -\u003e Option\u003cPathBuf\u003e {\n        let mut p = PathBuf::new();\n        p.push(\"examples/filename.png\");\n        Some(p)\n    }\n}\n\nfn upload((mp, state): (Multipart, Data\u003cForm\u003e)) -\u003e Box\u003cFuture\u003cItem = HttpResponse, Error = Error\u003e\u003e {\n    Box::new(\n        handle_multipart(mp, state.get_ref().clone()).map(|uploaded_content| {\n            println!(\"Uploaded Content: {:?}\", uploaded_content);\n            HttpResponse::Created().finish()\n        }),\n    )\n}\n\nfn main() -\u003e Result\u003c(), failure::Error\u003e {\n    let form = Form::new()\n        .field(\"Hey\", Field::text())\n        .field(\n            \"Hi\",\n            Field::map()\n                .field(\"One\", Field::int())\n                .field(\"Two\", Field::float())\n                .finalize(),\n        )\n        .field(\"files\", Field::array(Field::file(Gen)));\n\n    println!(\"{:?}\", form);\n\n    HttpServer::new(move || {\n        App::new()\n            .data(form.clone())\n            .service(resource(\"/upload\").route(post().to(upload)))\n    })\n    .bind(\"127.0.0.1:8080\")?\n    .run()?;\n\n    Ok(())\n}\n}\n```\n\n### Contributing\nFeel free to open issues for anything you find an issue with. Please note that any contributed code will be licensed under the GPLv3.\n\n### License\n\nCopyright © 2018 Riley Trautman\n\nActix Form Data is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nActix Form Data is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. This file is part of Actix Form Data.\n\nYou should have received a copy of the GNU General Public License along with Actix Form Data. If not, see [http://www.gnu.org/licenses/](http://www.gnu.org/licenses/).\n","funding_links":["https://github.com/sponsors/bbqsrc","https://necessary.nu"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbqsrc%2Factix-form-data","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbbqsrc%2Factix-form-data","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbbqsrc%2Factix-form-data/lists"}