You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-177Lines changed: 6 additions & 177 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -235,9 +235,7 @@ transformation code from ImageKit docs as the name when using in the ```url``` f
235
235
The SDK provides a simple interface using the `.upload()` method to upload files to the ImageKit Media library. It
236
236
accepts all the parameters supported by the [ImageKit Upload API](https://docs.imagekit.io/api-reference/upload-file-api/server-side-file-upload).
237
237
238
-
The `upload()` method requires at least the `file` and the `file_name` parameter to upload a file and returns
239
-
a callback with the `error` and `result` as arguments. You can pass other parameters supported by the
240
-
ImageKit upload API using the same parameter name as specified in the upload API documentation. For example, to
238
+
The `upload()` method requires at least the `file` and the `file_name` parameter to upload a file. You can pass other parameters supported by the ImageKit upload API using the same parameter name as specified in the upload API documentation. For example, to
241
239
specify tags for a file at the time of upload use the tags parameter as specified in the
<spanclass="text-4505230f--TextH400-3033861f--textContentFamily-49a318e1"><spandata-key="11698"><spandata-offset-key="11698:0">This field accepts three kinds of values: -</span> <spandata-offset-key="11698:1">`binary`</span> <spandata-offset-key="11698:2">- You can send the content of the file as binary. This is used when a file is being uploaded from the browser. -</span> <spandata-offset-key="11698:3">`base64`</span> <spandata-offset-key="11698:4">- Base64 encoded string of file content. -</span> <spandata-offset-key="11698:5">`url`</span> <spandata-offset-key="11698:6">- URL of the file from where to download the content before uploading. Downloading file from URL might take longer, so it is recommended that you pass the binary or base64 content of the file. Pass the full URL, for example -</span> <spandata-offset-key="11698:7">`https://www.example.com/rest-of-the-image-path.jpg`</span><spandata-offset-key="11698:8">.</span></span></span>
<spanclass="text-4505230f--TextH400-3033861f--textContentFamily-49a318e1"><spandata-key="11739"><spandata-offset-key="11739:0">The name with which the file has to be uploaded.</span></span></span>
<spanclass="text-4505230f--TextH400-3033861f--textContentFamily-49a318e1"><spandata-key="11757"><spandata-offset-key="11757:0">Whether to use a unique filename for this file or not. - Accepts</span> <spandata-offset-key="11757:1">`true`</span> <spandata-offset-key="11757:2">or</span> <spandata-offset-key="11757:3">`false`</span><spandata-offset-key="11757:4">. - If set</span> <spandata-offset-key="11757:5">`true`</span><spandata-offset-key="11757:6">, ImageKit.io will add a unique suffix to the filename parameter to get a unique filename. - If set</span> <spandata-offset-key="11757:7">`false`</span><spandata-offset-key="11757:8">, then the image is uploaded with the provided filename parameter and any existing file with the same name is replaced.</span> <spandata-offset-key="11757:9">**Default value**</span> <spandata-offset-key="11757:10">-</span> <spandata-offset-key="11757:11">`true`</span></span></span>
<spanclass="text-4505230f--TextH400-3033861f--textContentFamily-49a318e1"><spandata-key="11810"><spandata-offset-key="11810:0">Set the tags while uploading the file. - Comma-separated value of tags in format</span> <spandata-offset-key="11810:1">`tag1,tag2,tag3`</span><spandata-offset-key="11810:2">. For example -</span> <spandata-offset-key="11810:3">`t-shirt,round-neck,men`</span> <spandata-offset-key="11810:4">- The maximum length of all characters should not exceed 500. -</span> <spandata-offset-key="11810:5">`%`</span> <spandata-offset-key="11810:6">is not allowed. - If this field is not specified and the file is overwritten then the tags will be removed.</span></span></span>
<span class="text-4505230f--TextH400-3033861f--textContentFamily-49a318e1"><span data-key="11855"><span data-offset-key="11855:0">The folder path (e.g.</span> <span data-offset-key="11855:1">`/images/folder/`</span><span data-offset-key="11855:2">) in which the image has to be uploaded. If the folder(s) didn't exist before, a new folder(s) is created. The folder name can contain: - Alphanumeric Characters:</span> <span data-offset-key="11855:3">`a-z`</span> <span data-offset-key="11855:4">,</span> <span data-offset-key="11855:5">`A-Z`</span> <span data-offset-key="11855:6">,</span> <span data-offset-key="11855:7">`0-9`</span> <span data-offset-key="11855:8">- Special Characters:</span> <span data-offset-key="11855:9">`/``_`</span> <span data-offset-key="11855:10">and</span> <span data-offset-key="11855:11">`-`</span> <span data-offset-key="11855:12">- Using multiple</span> <span data-offset-key="11855:13">`/`</span> <span data-offset-key="11855:14">creates a nested folder.</span> <span data-offset-key="11855:15">**Default value**</span> <span data-offset-key="11855:16">- /</span></span></span>
<spanclass="text-4505230f--TextH400-3033861f--textContentFamily-49a318e1"><spandata-key="11918"><spandata-offset-key="11918:0">Whether to mark the file as private or not. This is only relevant for image type files. - Accepts</span> <spandata-offset-key="11918:1">`true`</span> <spandata-offset-key="11918:2">or</span> <spandata-offset-key="11918:3">`false`</span><spandata-offset-key="11918:4">. - If set</span> <spandata-offset-key="11918:5">`true`</span><spandata-offset-key="11918:6">, the file is marked as private which restricts access to the original image URL and unnamed image transformations without signed URLs. Without the signed URL, only named transformations work on private images</span> <spandata-offset-key="11918:7">**Default value**</span> <spandata-offset-key="11918:8">-</span> <spandata-offset-key="11918:9">`false`</span></span></span>
<spanclass="text-4505230f--TextH400-3033861f--textContentFamily-49a318e1"><spandata-key="11965"><spandata-offset-key="11965:0">Define an important area in the image. This is only relevant for image type files.</span></span></span>
<spanclass="text-4505230f--TextH400-3033861f--textContentFamily-49a318e1"><spandata-key="1362a1a179384b28ba7e977050546dab"><spandata-offset-key="1362a1a179384b28ba7e977050546dab:0">To be passed as a string with the x and y coordinates of the top-left corner, and width and height of the area of interest in format</span> <spandata-offset-key="1362a1a179384b28ba7e977050546dab:1">`x,y,width,height`</span><spandata-offset-key="1362a1a179384b28ba7e977050546dab:2">. For example -</span> <spandata-offset-key="1362a1a179384b28ba7e977050546dab:3">`10,10,100,100`</span></span></span>
<spanclass="text-4505230f--TextH400-3033861f--textContentFamily-49a318e1"><spandata-key="2a3ff3400c6142118f3d9c3bd8bce8b5"><spandata-offset-key="2a3ff3400c6142118f3d9c3bd8bce8b5:0">Can be used with</span> <spandata-offset-key="2a3ff3400c6142118f3d9c3bd8bce8b5:1">`fo-custom`</span><spandata-offset-key="2a3ff3400c6142118f3d9c3bd8bce8b5:2">transformation.</span></span></span>
<spanclass="text-4505230f--TextH400-3033861f--textContentFamily-49a318e1"><spandata-key="f6e308adfee44156ad8ed6b849a7e65e"><spandata-offset-key="f6e308adfee44156ad8ed6b849a7e65e:0">If this field is not specified and the file is overwritten, then customCoordinates will be removed.</span></span></span>
<spanclass="text-4505230f--TextH400-3033861f--textContentFamily-49a318e1"><spandata-key="12003"><spandata-offset-key="12003:0">Comma-separated values of the fields that you want ImageKit.io to return in response. For example, set the value of this field to</span> <spandata-offset-key="12003:1">`tags,custom_coordinates,is_privateFile,metadata`</span> <spandata-offset-key="12003:2">to get value of</span> <spandata-offset-key="12003:3">`tags`</span><spandata-offset-key="12003:4">,</span> <spandata-offset-key="12003:5">`custom_coordinates`</span><spandata-offset-key="12003:6">,</span> <spandata-offset-key="12003:7">`is_privateFile`</span> <spandata-offset-key="12003:8">, and</span> <spandata-offset-key="12003:9">`metadata`</span> <spandata-offset-key="12003:10">in the response.</span></span></span>
417
-
418
-
</td>
419
-
420
-
</tr>
421
-
422
-
</tbody>
423
-
424
-
</table>
425
-
if upload is succeeded, `error` will be `None` and the result will be same as what is received from ImageKit's
426
-
servers. If the upload fails, `error` will be the same as what is received from ImageKit's servers and the result will
427
-
be `None`
255
+
If the upload succeed, `error` will be `null` and the `result` will be the same as what is received from ImageKit's servers.
256
+
If the upload fails, `error` will be the same as what is received from ImageKit's servers and the `result` will be null.
0 commit comments