Skip to content

Commit 94ca930

Browse files
authored
Merge pull request #115 from imagekit-developer/IK-1499
added checks parameter
2 parents ab086ba + 1798d46 commit 94ca930

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ The SDK provides the `IKUpload` component to upload files to the [ImageKit Media
638638
| 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/ |
639639
| publicKey | String | Optional. If not specified, the `publicKey` specified in the parent `IKContext` component is used.|
640640
| authenticator | ()=>Promise<{signature:string,token:string,expiry:number}> | Optional. If not specified, the `authenticator` specified in the parent `IKContext` component is used. |
641+
| 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.` |
641642

642643
> 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.
643644

@@ -662,6 +663,7 @@ Sample file upload:
662663
}
663664
]
664665
}"
666+
checks= "'file.size' < '1mb'"
665667
/>
666668
</template>
667669

@@ -721,6 +723,7 @@ Example Usage
721723
}
722724
]
723725
}"
726+
checks= "'file.size' < '1mb'"
724727
/>
725728
<button @click="abortChildUpload">Abort Child Upload</button>
726729
</template>

package-lock.json

+6-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "imagekitio-vue",
3-
"version": "3.0.1",
3+
"version": "3.1.0",
44
"scripts": {
55
"build:lib": "./node_modules/.bin/vue-cli-service build --target lib src/index.js",
66
"build": "./node_modules/.bin/vue-cli-service lint --fix; npm run build:lib",
@@ -21,7 +21,7 @@
2121
"dependencies": {
2222
"babel-eslint": "^10.1.0",
2323
"cypress-file-upload": "^5.0.8",
24-
"imagekit-javascript": "^3.0.0"
24+
"imagekit-javascript": "^3.0.2"
2525
},
2626
"devDependencies": {
2727
"@babel/core": "^7.12.16",

src/components/IKUpload.vue

+3-1
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export default {
3535
onUploadStart: { type: Function, required: false },
3636
onUploadProgress: { type: Function, required: false },
3737
transformation: { type: Object, required: false },
38+
checks: { type: String, required: false },
3839
},
3940
setup(props) {
4041
const xhrRef = ref(null);
@@ -159,7 +160,8 @@ export default {
159160
token,
160161
expire,
161162
xhr,
162-
transformation: props.transformation
163+
transformation: props.transformation,
164+
checks: props.checks
163165
},
164166
(err, result) => {
165167
if (err && typeof props.onError === "function") {

0 commit comments

Comments
 (0)