{"id":36980743,"url":"https://github.com/lodev09/php-upload","last_synced_at":"2026-01-13T22:50:31.317Z","repository":{"id":62518689,"uuid":"20817982","full_name":"lodev09/php-upload","owner":"lodev09","description":"A very simple yet useful helper class to handle PHP file uploads.","archived":false,"fork":false,"pushed_at":"2021-03-10T22:50:50.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-31T04:41:50.951Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/lodev09/php-upload","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lodev09.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}},"created_at":"2014-06-13T21:13:48.000Z","updated_at":"2021-03-10T22:50:38.000Z","dependencies_parsed_at":"2022-11-02T10:31:41.633Z","dependency_job_id":null,"html_url":"https://github.com/lodev09/php-upload","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/lodev09/php-upload","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lodev09%2Fphp-upload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lodev09%2Fphp-upload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lodev09%2Fphp-upload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lodev09%2Fphp-upload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lodev09","download_url":"https://codeload.github.com/lodev09/php-upload/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lodev09%2Fphp-upload/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28402161,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2026-01-13T22:50:30.576Z","updated_at":"2026-01-13T22:50:31.309Z","avatar_url":"https://github.com/lodev09.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"PHP FileUpload Class\n============================\nA very simple yet useful helper class to handle PHP file uploads.\n\n## Features\n- Supports Multiple file uploads\n- Supports Exif for images\n- Built-in and Custom validations\n- Simple implementation\n- or you can ask for more ...\n\n## Installation\n```term\n$ composer require lodev09/php-upload\n```\n\n## Usage\n\n### HTML\n```html\n\u003cform action=\"index.php\" method=\"post\" enctype=\"multipart/form-data\"\u003e\n    \u003cinput type=\"file\" name=\"files[]\" multiple /\u003e\u003cbr\u003e\n    \u003cinput type=\"submit\" name=\"submit\" value=\"Submit\" /\u003e\n\u003c/form\u003e\n```\n\n### PHP (server side)\n```php\nuse \\Upload\\Upload;\n\nif (isset($_FILES['files'])) {\n    $validations = array(\n        'category' =\u003e array('document', 'image', 'video'), // validate only those files within this list\n        'size' =\u003e 20 // maximum of 20mb\n    );\n\n    // create new instance\n    $upload = new Upload($_FILES['files'], $validations);\n\n    // for each file\n    foreach ($upload-\u003efiles as $file) {\n        if ($file-\u003evalidate()) {\n            // do your thing on this file ...\n            // ...\n            // say we don't allow audio files\n            if ($file-\u003eis('audio')) $error = 'Audio not allowed';\n            else {\n                // then get base64 encoded string to do something else ...\n                $filedata = $file-\u003eget_base64();\n\n                // or get the GPS info ...\n                $gps = $file-\u003eget_exif_gps();\n\n                // then we move it to 'path/to/my/uploads'\n                $result = $file-\u003eput('path/to/my/uploads');\n                $error = $result ? '' : 'Error moving file';\n            }\n\n        } else {\n            // oopps!\n            $error = $file-\u003eget_error();\n        }\n\n        echo $file-\u003ename.' - '.($error ? ' [FAILED] '.$error : ' Succeeded!');\n        echo '\u003cbr /\u003e';\n    }\n}\n\n?\u003e\n```\n\n## Feedback\nAll bugs, feature requests, pull requests, feedback, etc., are welcome. Visit my site at [www.lodev09.com](http://www.lodev09.com \"www.lodev09.com\") or email me at [lodev09@gmail.com](mailto:lodev09@gmail.com)\n\n## Credits\n\u0026copy; 2018 - Coded by Jovanni Lo / [@lodev09](http://twitter.com/lodev09)\n\n## License\nReleased under the [MIT License](http://opensource.org/licenses/MIT).\nSee [LICENSE](LICENSE) file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flodev09%2Fphp-upload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flodev09%2Fphp-upload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flodev09%2Fphp-upload/lists"}