Skip to content

Commit

Permalink
Merge pull request #115 from imagekit-developer/IK-1499
Browse files Browse the repository at this point in the history
added checks parameter
  • Loading branch information
ahnv authored Sep 6, 2024
2 parents ab086ba + 1798d46 commit 94ca930
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ The SDK provides the `IKUpload` component to upload files to the [ImageKit Media
| urlEndpoint | String | Optional. If not specified, the URL-endpoint specified in the parent `IKContext` component is used. For example, https://ik.imagekit.io/your_imagekit_id/endpoint/ |
| publicKey | String | Optional. If not specified, the `publicKey` specified in the parent `IKContext` component is used.|
| authenticator | ()=>Promise<{signature:string,token:string,expiry:number}> | Optional. If not specified, the `authenticator` specified in the parent `IKContext` component is used. |
| checks | String | Optional. Run server-side checks before uploading files. For example, `"'file.size' < '1mb'"` will check if the file size is less than 1 MB. Check [Upload API docs](https://imagekit.io/docs/api-reference/upload-file/upload-file#upload-api-checks) to learn more. Notice the quotes around `file.size` and `1mb`; otherwise, you will get an error `Your request contains invalid syntax for the checks parameter.` |

> Make sure that you have specified authenticator and publicKey in IKUpload or in the parent IKContext component as a prop. The authenticator expects an asynchronous function that resolves with an object containing the necessary security parameters i.e signature, token, and expire.

Expand All @@ -662,6 +663,7 @@ Sample file upload:
}
]
}"
checks= "'file.size' < '1mb'"
/>
</template>

Expand Down Expand Up @@ -721,6 +723,7 @@ Example Usage
}
]
}"
checks= "'file.size' < '1mb'"
/>
<button @click="abortChildUpload">Abort Child Upload</button>
</template>
Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "imagekitio-vue",
"version": "3.0.1",
"version": "3.1.0",
"scripts": {
"build:lib": "./node_modules/.bin/vue-cli-service build --target lib src/index.js",
"build": "./node_modules/.bin/vue-cli-service lint --fix; npm run build:lib",
Expand All @@ -21,7 +21,7 @@
"dependencies": {
"babel-eslint": "^10.1.0",
"cypress-file-upload": "^5.0.8",
"imagekit-javascript": "^3.0.0"
"imagekit-javascript": "^3.0.2"
},
"devDependencies": {
"@babel/core": "^7.12.16",
Expand Down
4 changes: 3 additions & 1 deletion src/components/IKUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export default {
onUploadStart: { type: Function, required: false },
onUploadProgress: { type: Function, required: false },
transformation: { type: Object, required: false },
checks: { type: String, required: false },
},
setup(props) {
const xhrRef = ref(null);
Expand Down Expand Up @@ -159,7 +160,8 @@ export default {
token,
expire,
xhr,
transformation: props.transformation
transformation: props.transformation,
checks: props.checks
},
(err, result) => {
if (err && typeof props.onError === "function") {
Expand Down

0 comments on commit 94ca930

Please sign in to comment.