{"id":16049995,"url":"https://github.com/codad5/php-file-uploader","last_synced_at":"2025-03-17T21:31:14.751Z","repository":{"id":54348724,"uuid":"522057274","full_name":"codad5/php-file-uploader","owner":"codad5","description":"FIle Uploader is a php package to aid fast , easy and safe file upload","archived":false,"fork":false,"pushed_at":"2022-09-19T12:45:40.000Z","size":28,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-28T04:47:24.088Z","etag":null,"topics":["file-upload","files","package","php","php-library"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/codad5.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-06T21:27:03.000Z","updated_at":"2023-06-29T05:55:29.000Z","dependencies_parsed_at":"2022-08-13T12:50:47.055Z","dependency_job_id":null,"html_url":"https://github.com/codad5/php-file-uploader","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codad5%2Fphp-file-uploader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codad5%2Fphp-file-uploader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codad5%2Fphp-file-uploader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codad5%2Fphp-file-uploader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codad5","download_url":"https://codeload.github.com/codad5/php-file-uploader/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243885935,"owners_count":20363644,"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","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":["file-upload","files","package","php","php-library"],"created_at":"2024-10-09T00:41:40.227Z","updated_at":"2025-03-17T21:31:14.508Z","avatar_url":"https://github.com/codad5.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FILE UPLOADER\nFIle Uploader is a php package to aid fast , easy and safe file upload\n\n## installation\n```bash\ncomposer require codad5/file-helper\n```\n## Features\n- Fast and easy to use with method chaining\n- Good error management\n- Safety management\n- works for both multiple file upload and single file upload\n\n## Usage\n`index.php`\n```html\n\u003cform action=\"./upload.php\" method='post' enctype=\"multipart/form-data\"\u003e\n    \u003cinput type=\"file\" name=\"test[]\" multiple\u003e\n    \u003cinput value=\"submit\" type=\"submit\"\u003e\n\u003c/form\u003e\n```\n`upload.php`\n```php\n\u003c?php\n    include(__DIR__ . '/../vendor/autoload.php');\n    \n    $file_upload_controller = new Codad5\\FileHelper\\FileUploader('test', \"uploads/\");\n```\n`test` - the name given to the `$_FILES` array by default - for refrence `$_FILES['test`]`\n\n`uploads/` - Upload path relative to `upload.php`\n\n\n### To add allowed extension \n\n```php\n#any other extension aid the given will give error or ignored depending on your error settings\n$file_upload_controller-\u003eadd_ext('svg', 'png');\n```\n### To set File Prefix \n```php\n# for unique id can be replaced with uniqid('', true)\n$file_upload_controller-\u003eset_prefix('my prefix');\n```\n### To set max and min size\n```php\n$file_upload_controller-\u003eset_sizes(10000, 20);\n```\n`10000` - This is the maximum file size allowed, to ignore for your `.ini` config set it to `null`\n`20` - This is the minimum file size allowed default equals `0`\n\n### Turing on/Off Error reporting \n```php\n/**\n * This is use to turn on and off reporting of the upload process\n * @param bool $file_error - to report error imbound in file from request if `true` else ignore\n * @param bool $size_error - TO report size related error if `true` else ignore\n * @param bool $type_error - To report error related to file type if `true` else ignore\n */\n$file_upload_controller-\u003eset_reporting(true, false, true);\n```\n- The first param `$file_error` is to report error imbounded in file from request as found in `$_SERVER['test']`\n- The second param `$size_error` is to report size related error depending on your settings\n- The Third param `$type_error` is to report error if a file is not part of the allowed file\n\u003e NOTE: If any is `false` and error is found it will ignore the file and continue upload with out the file\n\n### Moving the file\n```php\n\n$file_upload_controller-\u003emove_files();\n\n```\n### Get Uploaded file path\n```php\n\n$upload_path = $file_upload_controller-\u003eget_uploads();\n\nforeach ($upload_path as $key =\u003e $value) {\n        # code...\n        echo \"This file has been uploaded to \".$value['uploaded_path'].\"\u003cbr/\u003e;\n    }\n\n```\n- This returns a multi-dimensional array of each array with the following key\n- `uploaded_path` - The final uploaded file with path relative to the script tag `upload.php`\n- `name` - The name of the file \n- `size` - The size of the file\n- `type` - The file Type\n- `ext` - The file extension\n\n### Method Chaining \n```php\n\n$file_upload_controller = new \\Codad5\\FileHelper\\FileUploader('tes', \"uploads/\");\n\n    $uploaded_file_array = $file_upload_controller\n    -\u003eset_reporting(false, false, false)\n    -\u003eadd_ext('png', 'pdf')\n    -\u003eset_prefix('cool Stuff')\n    -\u003emove_files()\n    -\u003eget_uploads();\n\n    foreach ($uploaded_file_array as $key =\u003e $value) {\n        # code...\n        echo \"This file has been uploaded to \".$value['uploaded_path'].\"\u003cbr/\u003e\";\n    }\n\n```\n\n\n\u003e This documentaion will be updated in time as the project grows\n\u003e for enquire and more information [contact me here](https://twitter.com/codad5_)\n\nBuilt with 💗 by [Chibueze Michael A.](https://github.com/codad5)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodad5%2Fphp-file-uploader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodad5%2Fphp-file-uploader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodad5%2Fphp-file-uploader/lists"}