{"id":19345552,"url":"https://github.com/future-team/ph-image-upload","last_synced_at":"2026-05-16T02:39:05.400Z","repository":{"id":57322742,"uuid":"63850584","full_name":"future-team/ph-image-upload","owner":"future-team","description":"基于phonexi-ui的图片上传组件","archived":false,"fork":false,"pushed_at":"2018-09-28T03:53:40.000Z","size":9472,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-02-06T15:05:42.265Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/future-team.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":"2016-07-21T08:18:08.000Z","updated_at":"2018-09-28T03:53:41.000Z","dependencies_parsed_at":"2022-08-25T22:42:33.358Z","dependency_job_id":null,"html_url":"https://github.com/future-team/ph-image-upload","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/future-team%2Fph-image-upload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/future-team%2Fph-image-upload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/future-team%2Fph-image-upload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/future-team%2Fph-image-upload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/future-team","download_url":"https://codeload.github.com/future-team/ph-image-upload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240452177,"owners_count":19803579,"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":[],"created_at":"2024-11-10T04:07:00.493Z","updated_at":"2026-05-16T02:39:05.331Z","avatar_url":"https://github.com/future-team.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ph-image-upload\n\nupload image or other file\n\ndemo地址 [https://future-team.github.io/ph-image-upload/example/index.html](https://future-team.github.io/ph-image-upload/example/index.html)\n\n\n```jsx\n \u003cImgUpload multiple\n            className='my-class'\n            filter={::this.filter}\n            successCallback={::this.successCallback}\n            failCallback={::this.failCallback}\n            completeCallback={::this.completeCallback}\n            uploadUrl=\"http://beta.ask.sankuai.com/attachment/upload\" \u003e\n            \u003clabel style={{display:'inline-block',width:'100px',height:'100px'}}\u003e\n                这是一个上传按钮\n            \u003c/label\u003e\n\u003c/ImgUpload\u003e\n```\n```js\n funnction filter(files, maxSize) {\n        var arrFiles = [];\n        for (var i = 0, file; file = files[i]; i++) {\n            if (file.type.indexOf(\"image\") == 0 || file.type.indexOf(\"pdf\") \u003e= 0 || file.type.indexOf(\"msword\") \u003e= 0\n                || file.type.indexOf(\"vnd.openxmlformats-officedocument.wordprocessingml.document\") \u003e= 0\n                || file.type.indexOf(\"csv\") \u003e= 0 || file.type.indexOf(\"vnd.ms-excel\") \u003e= 0\n                || file.type.indexOf(\"vnd.openxmlformats-officedocument.spreadsheetml.sheet\") \u003e= 0\n                || file.type.indexOf(\"vnd.openxmlformats-officedocument.presentationml.presentation\") \u003e= 0\n                || file.type.indexOf(\"vnd.ms-powerpoint\") \u003e= 0) {\n                arrFiles.push(file);\n            }else {\n                alert('只能上传图片、doc、docx、xls、xlsx、pdf文件，上传文件\"' + file.name + '\"错误。');\n            }\n        }\n        return arrFiles;\n    }\n    funnction successCallback(file,response){\n        console.log('success',file,response);\n    }\n    funnction failCallback(file,response){\n        console.log('fail',file,response);\n    }\n    funnction completeCallback(uploadInfo,successNum){\n        console.log('complete',uploadInfo,successNum)\n    }\n```\n\n##  API\nView [example](/example/src/index.js) to get more details\n\n#### `\u003cImgUpload\u003e` Props:\n- multiple 用来控制input file 的单选和多选 .\n- successCallback 每当上传成功一个文件，该方法都会被调用.\n- failCallback 每当一个文件上传失败，该方法都会被调用.\n- beforeUploadCallback 当文件开始上传前调用.\n- completeCallback 当所有文件都成功上传后，该方法会被调用.\n- filter: 用于过滤用户选择的文件\n- uploadUrl: 上传地址\n- disabled: 是否禁止上传\n- chooseFile方法 通过给ImgUpload添加ref的形式，可以通过chooseFile方法来手动触发上传图片\n\n### Contributing\n\n- Fork the project\n- Run the project in development view demo: `$ npm run demo`\n- Make changes.\n- Add appropriate tests\n- `$ npm run test`\n- If tests don't pass, make them pass.\n- Update README with appropriate docs.\n- Rnn build\n- `$ npm run build`\n- Commit and PR.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuture-team%2Fph-image-upload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffuture-team%2Fph-image-upload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffuture-team%2Fph-image-upload/lists"}