1# @ohos.file.picker (Picker)
2
3> **NOTE**
4>
5> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
6
7The **picker** module encapsulates APIs of **PhotoViewPicker**, **DocumentViewPicker**, and **AudioViewPicker** to provide capabilities for selecting and saving images and videos, documents, and audio clips. The application can select the Picker as required. The APIs of this module must be called in a UIAbility. Otherwise, the **photoPicker** or **FilePicker** application cannot be started.
8
9## Modules to Import
10
11```ts
12import  { picker } from '@kit.CoreFileKit';
13```
14
15## DocumentViewPicker
16
17Provides APIs for selecting and saving documents in different formats. Before using the APIs of **DocumentViewPicker**, you need to create a **DocumentViewPicker** instance.
18
19**System capability**: SystemCapability.FileManagement.UserFileService
20
21### constructor<sup>12+</sup>
22
23constructor(context: Context)
24
25A constructor used to create a **DocumentViewPicker** instance. This constructor is recommended. For details about how to obtain the context, see [getContext](../apis-arkui/js-apis-getContext.md).
26
27**Atomic service API**: This API can be used in atomic services since API version 12.
28
29**System capability**: SystemCapability.FileManagement.UserFileService
30
31**Parameters**
32| Name | Type   | Mandatory| Description                                                        |
33| ------- | ------- | ---- | ------------------------------------------------------------ |
34| context | Context| Yes  | Application context (only **UIAbilityContext** is supported). For details about the application context of the stage model, see [Context](../apis-ability-kit/js-apis-inner-application-context.md).|
35
36**Example**
37
38```ts
39import { common } from '@kit.AbilityKit';
40import  { picker } from '@kit.CoreFileKit';
41@Entry
42@Component
43struct Index {
44  @State message: string = 'hello World';
45
46  build() {
47    Row() {
48      Column() {
49        Text(this.message)
50          .fontSize(50)
51          .fontWeight(FontWeight.Bold)
52          .onClick(()=>{
53            let context = getContext (this) as common.Context; // Ensure that getContext (this) returns UIAbilityContext.
54            let documentPicker = new picker.DocumentViewPicker(context);
55          })
56      }
57      .width('100%')
58    }
59    .height('100%')
60  }
61}
62```
63
64### constructor<sup>12+</sup>
65
66constructor()
67
68A constructor used to create a **DocumentViewPicker** instance. This constructor is not recommended due to the potential risk of operation failure.
69
70**Atomic service API**: This API can be used in atomic services since API version 12.
71
72**System capability**: SystemCapability.FileManagement.UserFileService
73
74**Example**
75
76```ts
77let documentPicker = new picker.DocumentViewPicker(); // Construction without parameter is not recommended. There is a possibility that the DocumentViewPicker instance fails to start.
78```
79
80### constructor<sup>13+</sup>
81
82constructor(context: Context, window: window.Window)
83
84A constructor used to create a **DocumentViewPicker** object in a window created by an application. In other scenarios, you are advised to use **constructor(context: Context)** to create a **DocumentViewPicker** object.
85
86**Parameters**
87| Name | Type   | Mandatory| Description                                                        |
88| ------- | ------- | ---- | ------------------------------------------------------------ |
89| context | Context| Yes  | Application context (only **UIAbilityContext** is supported). For details about the application context of the stage model, see [Context](../apis-ability-kit/js-apis-inner-application-context.md).|
90| window  | [window.Window](../apis-arkui/js-apis-window.md#window)  | Yes  | Window instance created by the application.|
91
92> **NOTE**
93>
94> Currently, only mobile phones are supported.
95
96**System capability**: SystemCapability.FileManagement.UserFileService
97
98**Example**
99
100```ts
101import { common } from '@kit.AbilityKit';
102import { picker } from '@kit.CoreFileKit';
103import { window } from '@kit.ArkUI';
104@Entry
105@Component
106struct Index {
107  @State message: string = 'hello World';
108
109  build() {
110    Row() {
111      Column() {
112        Text(this.message)
113          .fontSize(50)
114          .fontWeight(FontWeight.Bold)
115          .onClick(()=>{
116            let context = getContext (this) as common.Context; // Ensure that getContext (this) returns UIAbilityContext.
117            let windowClass: window.Window | undefined = undefined;
118            windowClass = window.findWindow ('test'); // Ensure that the window has been created. Here, 'test' is the value of the name parameter when the window is created.
119            let documentPicker = new picker.DocumentViewPicker(context, windowClass);
120          })
121      }
122      .width('100%')
123    }
124    .height('100%')
125  }
126}
127```
128
129### select
130
131select(option?: DocumentSelectOptions): Promise&lt;Array&lt;string&gt;&gt;
132
133Starts a **documentPicker** page for the user to select one or more documents. This API uses a promise to return the result. You can pass in **DocumentSelectOptions**.
134
135> **NOTE**<br>For details about how to use the returned URIs, see [Using a Document URI](../../file-management/user-file-uri-intro.md#using-a-document-uri).
136
137**Atomic service API**: This API can be used in atomic services since API version 12.
138
139**System capability**: SystemCapability.FileManagement.UserFileService
140
141**Parameters**
142
143| Name | Type   | Mandatory| Description                      |
144| ------- | ------- | ---- | -------------------------- |
145| option | [DocumentSelectOptions](#documentselectoptions) | No  | Options for selecting documents. If this parameter is not specified, the **documentPicker** page is displayed by default.|
146
147**Return value**
148
149| Type                           | Description   |
150| ----------------------------- | :---- |
151| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the URIs of the documents selected.|
152
153**Example**
154
155```ts
156import { BusinessError } from '@kit.BasicServicesKit';
157import { common } from '@kit.AbilityKit';
158import  { picker } from '@kit.CoreFileKit';
159async function example07(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
160  try {
161    let documentSelectOptions = new picker.DocumentSelectOptions();
162    let documentPicker = new picker.DocumentViewPicker(context);
163    documentPicker.select(documentSelectOptions).then((documentSelectResult: Array<string>) => {
164      console.info('DocumentViewPicker.select successfully, documentSelectResult uri: ' + JSON.stringify(documentSelectResult));
165    }).catch((err: BusinessError) => {
166      console.error('DocumentViewPicker.select failed with err: ' + JSON.stringify(err));
167    });
168  } catch (error) {
169    let err: BusinessError = error as BusinessError;
170    console.error('DocumentViewPicker failed with err: ' + JSON.stringify(err));
171  }
172}
173```
174
175### select
176
177select(option: DocumentSelectOptions, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
178
179Starts a **documentPicker** page for the user to select one or more documents. This API uses an asynchronous callback to return the result. You can pass in **DocumentSelectOptions**.
180
181> **NOTE**<br>For details about how to use the returned URIs, see [Using a Document URI](../../file-management/user-file-uri-intro.md#using-a-document-uri).
182
183**Atomic service API**: This API can be used in atomic services since API version 12.
184
185**System capability**: SystemCapability.FileManagement.UserFileService
186
187**Parameters**
188
189| Name | Type   | Mandatory| Description                      |
190| ------- | ------- | ---- | -------------------------- |
191| option | [DocumentSelectOptions](#documentselectoptions) | Yes  | Options for selecting documents.|
192| callback | AsyncCallback&lt;Array&lt;string&gt;&gt;      | Yes  | Callback invoked to return the URIs of the documents selected.|
193
194**Example**
195
196```ts
197import { BusinessError } from '@kit.BasicServicesKit';
198import { common } from '@kit.AbilityKit';
199import  { picker } from '@kit.CoreFileKit';
200async function example08(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
201  try {
202    let documentSelectOptions = new picker.DocumentSelectOptions();
203    let documentPicker = new picker.DocumentViewPicker(context);
204    documentPicker.select(documentSelectOptions, (err: BusinessError, documentSelectResult: Array<string>) => {
205      if (err) {
206        console.error('DocumentViewPicker.select failed with err: ' + JSON.stringify(err));
207        return;
208      }
209      console.info('DocumentViewPicker.select successfully, documentSelectResult uri: ' + JSON.stringify(documentSelectResult));
210    });
211  } catch (error) {
212    let err: BusinessError = error as BusinessError;
213    console.error('DocumentViewPicker failed with err: ' + JSON.stringify(err));
214  }
215}
216```
217
218### select
219
220select(callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
221
222Starts a **documentPicker** page for the user to select one or more documents. This API uses an asynchronous callback to return the result.
223
224> **NOTE**<br>For details about how to use the returned URIs, see [Using a Document URI](../../file-management/user-file-uri-intro.md#using-a-document-uri).
225
226**Atomic service API**: This API can be used in atomic services since API version 12.
227
228**System capability**: SystemCapability.FileManagement.UserFileService
229
230**Parameters**
231
232| Name | Type   | Mandatory| Description                      |
233| ------- | ------- | ---- | -------------------------- |
234| callback | AsyncCallback&lt;Array&lt;string&gt;&gt;      | Yes  | Callback invoked to return the URIs of the documents selected.|
235
236**Example**
237
238```ts
239import { BusinessError } from '@kit.BasicServicesKit';
240import { common } from '@kit.AbilityKit';
241import  { picker } from '@kit.CoreFileKit';
242async function example09(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
243  try {
244    let documentPicker = new picker.DocumentViewPicker(context);
245    documentPicker.select((err: BusinessError, documentSelectResult: Array<string>) => {
246      if (err) {
247        console.error('DocumentViewPicker.select failed with err: ' + JSON.stringify(err));
248        return;
249      }
250      console.info('DocumentViewPicker.select successfully, documentSelectResult uri: ' + JSON.stringify(documentSelectResult));
251    });
252  } catch (error) {
253    let err: BusinessError = error as BusinessError;
254    console.error('DocumentViewPicker failed with err: ' + JSON.stringify(err));
255  }
256}
257```
258
259### save
260
261save(option?: DocumentSaveOptions): Promise&lt;Array&lt;string&gt;&gt;
262
263Starts a **documentPicker** page for the user to save one or more documents. This API uses a promise to return the result. You can pass in **DocumentSaveOptions** to specify the file names to save.
264
265> **NOTE**<br>For details about how to use the returned URIs, see [Using a Document URI](../../file-management/user-file-uri-intro.md#using-a-document-uri).
266
267**Atomic service API**: This API can be used in atomic services since API version 12.
268
269**System capability**: SystemCapability.FileManagement.UserFileService
270
271**Parameters**
272
273| Name | Type   | Mandatory| Description                      |
274| ------- | ------- | ---- | -------------------------- |
275| option | [DocumentSaveOptions](#documentsaveoptions) | No  | Options for saving the documents. If this parameter is not specified, a **documentPicker** page will be displayed for the user to enter the names of the documents to save.|
276
277**Return value**
278
279| Type                           | Description   |
280| ----------------------------- | :---- |
281| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the URIs of the documents saved.|
282
283**Example**
284
285```ts
286import { BusinessError } from '@kit.BasicServicesKit';
287import { common } from '@kit.AbilityKit';
288import  { picker } from '@kit.CoreFileKit';
289async function example10(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
290  try {
291    let documentSaveOptions = new picker.DocumentSaveOptions();
292    documentSaveOptions.newFileNames = ['DocumentViewPicker01.txt'];
293    let documentPicker = new picker.DocumentViewPicker(context);
294    documentPicker.save(documentSaveOptions).then((documentSaveResult: Array<string>) => {
295      console.info('DocumentViewPicker.save successfully, documentSaveResult uri: ' + JSON.stringify(documentSaveResult));
296    }).catch((err: BusinessError) => {
297      console.error('DocumentViewPicker.save failed with err: ' + JSON.stringify(err));
298    });
299  } catch (error) {
300    let err: BusinessError = error as BusinessError;
301    console.error('DocumentViewPicker failed with err: ' + JSON.stringify(err));
302  }
303}
304```
305
306### save
307
308save(option: DocumentSaveOptions, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
309
310Starts a **documentPicker** page for the user to save one or more documents. This API uses an asynchronous callback to return the result. You can pass in **DocumentSaveOptions** to specify the file names to save.
311
312> **NOTE**<br>For details about how to use the returned URIs, see [Using a Document URI](../../file-management/user-file-uri-intro.md#using-a-document-uri).
313
314**Atomic service API**: This API can be used in atomic services since API version 12.
315
316**System capability**: SystemCapability.FileManagement.UserFileService
317
318**Parameters**
319
320| Name | Type   | Mandatory| Description                      |
321| ------- | ------- | ---- | -------------------------- |
322| option | [DocumentSaveOptions](#documentsaveoptions) | Yes  | Options for saving the documents.|
323| callback | AsyncCallback&lt;Array&lt;string&gt;&gt;      | Yes  | Callback invoked to return the URIs of the documents saved.|
324
325**Example**
326
327```ts
328import { BusinessError } from '@kit.BasicServicesKit';
329import { common } from '@kit.AbilityKit';
330import  { picker } from '@kit.CoreFileKit';
331async function example11(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
332  try {
333    let documentSaveOptions = new picker.DocumentSaveOptions();
334    documentSaveOptions.newFileNames = ['DocumentViewPicker02.txt'];
335    let documentPicker = new picker.DocumentViewPicker(context);
336    documentPicker.save(documentSaveOptions, (err: BusinessError, documentSaveResult: Array<string>) => {
337      if (err) {
338        console.error('DocumentViewPicker.save failed with err: ' + JSON.stringify(err));
339        return;
340      }
341      console.info('DocumentViewPicker.save successfully, documentSaveResult uri: ' + JSON.stringify(documentSaveResult));
342    });
343  } catch (error) {
344    let err: BusinessError = error as BusinessError;
345    console.error('DocumentViewPicker failed with err: ' + JSON.stringify(err));
346  }
347}
348```
349
350### save
351
352save(callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
353
354Starts a **documentPicker** page for the user to save one or more documents. This API uses an asynchronous callback to return the result.
355
356> **NOTE**<br>For details about how to use the returned URIs, see [Using a Document URI](../../file-management/user-file-uri-intro.md#using-a-document-uri).
357
358**Atomic service API**: This API can be used in atomic services since API version 12.
359
360**System capability**: SystemCapability.FileManagement.UserFileService
361
362**Parameters**
363
364| Name | Type   | Mandatory| Description                      |
365| ------- | ------- | ---- | -------------------------- |
366| callback | AsyncCallback&lt;Array&lt;string&gt;&gt;      | Yes  | Callback invoked to return the URIs of the documents saved.|
367
368**Example**
369
370```ts
371import { BusinessError } from '@kit.BasicServicesKit';
372import { common } from '@kit.AbilityKit';
373import  { picker } from '@kit.CoreFileKit';
374async function example12(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
375  try {
376    let documentPicker = new picker.DocumentViewPicker(context);
377    documentPicker.save((err: BusinessError, documentSaveResult: Array<string>) => {
378      if (err) {
379        console.error('DocumentViewPicker.save failed with err: ' + JSON.stringify(err));
380        return;
381      }
382      console.info('DocumentViewPicker.save successfully, documentSaveResult uri: ' + JSON.stringify(documentSaveResult));
383    });
384  } catch (error) {
385    let err: BusinessError = error as BusinessError;
386    console.error('DocumentViewPicker failed with err: ' + JSON.stringify(err));
387  }
388}
389```
390
391### getSelectedIndex<sup>13+</sup>;
392
393getSelectedIndex(): number
394
395**Atomic service API**: This API can be used in atomic services since API version 13.
396
397**System capability**: SystemCapability.FileManagement.UserFileService
398
399Obtains the subscript of the file name extension type of the file saved.
400  > **NOTE**
401  >
402  > - The **getSelectedIndex()** method takes effect only when used with [save()](#save).
403  > - **getSelectedIndex()** can be used only after [DocumentSaveOptions.fileSuffixChoices](#documentsaveoptions) is configured.
404  > - The subscript (number) returned by **getSelectedIndex()** indicates the location of the filename extension specified in [DocumentSaveOptions.fileSuffixChoices](#documentsaveoptions). If no filename extension is specified, **getSelectedIndex()** returns **-1**.
405
406```ts
407import { BusinessError } from '@kit.BasicServicesKit';
408import { common } from '@kit.AbilityKit';
409import  { picker } from '@kit.CoreFileKit';
410async function exampleIndex(context: common.Context) { // Ensure that context is converted from UIAbilityContext.
411  try {
412    let documentSaveOptions = new picker.DocumentSaveOptions();
413    // Name of the file to save.
414    documentSaveOptions.newFileNames = ['DocumentViewPicker01'];
415    // File name extensions for the file to save.
416    documentSaveOptions.fileSuffixChoices = ['txt', 'mp4', 'pdf'];
417    let documentPicker = new picker.DocumentViewPicker(context);
418    documentPicker.save(documentSaveOptions).then((documentSaveResult: Array<string>) => {
419      if (documentSaveOptions.fileSuffixChoices != undefined && documentSaveResult != undefined) {
420        // Obtain the subscript of the filename extension of the file saved.
421        let index = documentPicker.getSelectedIndex();
422        // Obtain the filename extension of the file saved.
423        let selectedsuffix = documentSaveOptions.fileSuffixChoices[index];
424        console.info ('DocumentViewPicker.save selectedsuffix is ' + selectedsuffix);
425      }
426      console.info('DocumentViewPicker.save successfully, documentSaveResult uri: ' + JSON.stringify(documentSaveResult));
427    }).catch((err: BusinessError) => {
428      console.error('DocumentViewPicker.save failed with err: ' + JSON.stringify(err));
429    });
430  } catch (error) {
431    let err: BusinessError = error as BusinessError;
432    console.error('DocumentViewPicker failed with err: ' + JSON.stringify(err));
433  }
434}
435```
436## AudioViewPicker
437
438Provides APIs for selecting and saving audio clips. Before using the APIs of **AudioViewPicker**, you need to create an **AudioViewPicker** instance.
439
440**System capability**: SystemCapability.FileManagement.UserFileService
441
442### constructor<sup>12+</sup>
443
444constructor(context: Context)
445
446A constructor used to create an **AudioViewPicker** instance. This constructor is recommended. For details about how to obtain the context, see [getContext](../apis-arkui/js-apis-getContext.md).
447
448**Atomic service API**: This API can be used in atomic services since API version 12.
449
450**System capability**: SystemCapability.FileManagement.UserFileService
451
452**Parameters**
453| Name | Type   | Mandatory| Description                                                        |
454| ------- | ------- | ---- | ------------------------------------------------------------ |
455| context | Context| Yes  | Application context (only **UIAbilityContext** is supported). For details about the application context of the stage model, see [Context](../apis-ability-kit/js-apis-inner-application-context.md).|
456
457**Example**
458
459```ts
460import { common } from '@kit.AbilityKit';
461import  { picker } from '@kit.CoreFileKit';
462@Entry
463@Component
464struct Index {
465  @State message: string = 'hello World';
466
467  build() {
468    Row() {
469      Column() {
470        Text(this.message)
471          .fontSize(50)
472          .fontWeight(FontWeight.Bold)
473          .onClick(()=>{
474            let context = getContext (this) as common.Context; // Ensure that getContext (this) returns UIAbilityContext.
475            let audioPicker = new picker.AudioViewPicker(context);
476          })
477      }
478      .width('100%')
479    }
480    .height('100%')
481  }
482}
483```
484### constructor<sup>12+</sup>
485
486constructor()
487
488A constructor used to create an **AudioViewPicker** instance. This constructor is not recommended due to the potential risk of operation failure.
489
490**Atomic service API**: This API can be used in atomic services since API version 12.
491
492**System capability**: SystemCapability.FileManagement.UserFileService
493
494**Example**
495
496```ts
497let audioPicker = new picker.AudioViewPicker(); // Construction without parameter is not recommended. There is a possibility that the AudioViewPicker instance fails to start.
498```
499
500### select
501
502select(option?: AudioSelectOptions): Promise&lt;Array&lt;string&gt;&gt;
503
504Starts an **audioPicker** page for the user to select one or more audio clips. This API uses a promise to return the result. You can pass in **AudioSelectOptions**.
505
506> **NOTE**<br>For details about how to use the returned URIs, see [Using a Document URI](../../file-management/user-file-uri-intro.md#using-a-document-uri).
507
508**Atomic service API**: This API can be used in atomic services since API version 12.
509
510**System capability**: SystemCapability.FileManagement.UserFileService
511
512**Parameters**
513
514| Name | Type   | Mandatory| Description                      |
515| ------- | ------- | ---- | -------------------------- |
516| option | [AudioSelectOptions](#audioselectoptions) | No  | Options for selecting the audio clips. If this parameter is not specified, the **audioPicker** page is displayed by default. |
517
518**Return value**
519
520| Type                           | Description   |
521| ----------------------------- | :---- |
522| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the URIs of the audio clips selected.|
523
524**Example**
525
526```ts
527import { BusinessError } from '@kit.BasicServicesKit';
528import { common } from '@kit.AbilityKit';
529import  { picker } from '@kit.CoreFileKit';
530async function example13(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
531  try {
532    let audioSelectOptions = new picker.AudioSelectOptions();
533    let audioPicker = new picker.AudioViewPicker(context);
534    audioPicker.select(audioSelectOptions).then((audioSelectResult: Array<string>) => {
535      console.info('AudioViewPicker.select successfully, audioSelectResult uri: ' + JSON.stringify(audioSelectResult));
536    }).catch((err: BusinessError) => {
537      console.error('AudioViewPicker.select failed with err: ' + JSON.stringify(err));
538    });
539  } catch (error) {
540    let err: BusinessError = error as BusinessError;
541    console.error('AudioViewPicker failed with err: ' + JSON.stringify(err));
542  }
543}
544```
545
546### select
547
548select(option: AudioSelectOptions, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
549
550Starts an **audioPicker** page for the user to select one or more audio clips. This API uses an asynchronous callback to return the result. You can pass in **AudioSelectOptions**.
551
552> **NOTE**<br>For details about how to use the returned URIs, see [Using a Document URI](../../file-management/user-file-uri-intro.md#using-a-document-uri).
553
554**System capability**: SystemCapability.FileManagement.UserFileService
555
556**Parameters**
557
558| Name | Type   | Mandatory| Description                      |
559| ------- | ------- | ---- | -------------------------- |
560| option | [AudioSelectOptions](#audioselectoptions) | Yes  | Options for selecting audio clips.|
561| callback | AsyncCallback&lt;Array&lt;string&gt;&gt;      | Yes  | Callback invoked to return the URIs of the audio clips selected.|
562
563**Example**
564
565```ts
566import { BusinessError } from '@kit.BasicServicesKit';
567import { common } from '@kit.AbilityKit';
568import  { picker } from '@kit.CoreFileKit';
569async function example14(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
570  try {
571    let audioSelectOptions = new picker.AudioSelectOptions();
572    let audioPicker = new picker.AudioViewPicker(context);
573    audioPicker.select(audioSelectOptions, (err: BusinessError, audioSelectResult: Array<string>) => {
574      if (err) {
575        console.error('AudioViewPicker.select failed with err: ' + JSON.stringify(err));
576        return;
577      }
578      console.info('AudioViewPicker.select successfully, audioSelectResult uri: ' + JSON.stringify(audioSelectResult));
579    });
580  } catch (error) {
581    let err: BusinessError = error as BusinessError;
582    console.error('AudioViewPicker failed with err: ' + JSON.stringify(err));
583  }
584}
585```
586
587### select
588
589select(callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
590
591Starts an **audioPicker** page for the user to select one or more audio clips. This API uses an asynchronous callback to return the result.
592
593> **NOTE**<br>For details about how to use the returned URIs, see [Using a Document URI](../../file-management/user-file-uri-intro.md#using-a-document-uri).
594
595**System capability**: SystemCapability.FileManagement.UserFileService
596
597**Parameters**
598
599| Name | Type   | Mandatory| Description                      |
600| ------- | ------- | ---- | -------------------------- |
601| callback | AsyncCallback&lt;Array&lt;string&gt;&gt;      | Yes  | Callback invoked to return the URIs of the audio clips selected.|
602
603**Example**
604
605```ts
606import { BusinessError } from '@kit.BasicServicesKit';
607import { common } from '@kit.AbilityKit';
608import  { picker } from '@kit.CoreFileKit';
609async function example15(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
610  try {
611    let audioPicker = new picker.AudioViewPicker(context);
612    audioPicker.select((err: BusinessError, audioSelectResult: Array<string>) => {
613      if (err) {
614        console.error('AudioViewPicker.select failed with err: ' + JSON.stringify(err));
615        return;
616      }
617      console.info('AudioViewPicker.select successfully, audioSelectResult uri: ' + JSON.stringify(audioSelectResult));
618    });
619  } catch (error) {
620    let err: BusinessError = error as BusinessError;
621    console.error('AudioViewPicker failed with err: ' + JSON.stringify(err));
622  }
623}
624```
625
626### save
627
628save(option?: AudioSaveOptions): Promise&lt;Array&lt;string&gt;&gt;
629
630Starts an **audioPicker** page (currently, a **documentPicker** page is displayed) for the user to save one or more audio clips. This API uses a promise to return the result. You can pass in **AudioSaveOptions** to specify the file names of the audio clips to save.
631
632> **NOTE**<br>For details about how to use the returned URIs, see [Using a Document URI](../../file-management/user-file-uri-intro.md#using-a-document-uri).
633
634**Atomic service API**: This API can be used in atomic services since API version 12.
635
636**System capability**: SystemCapability.FileManagement.UserFileService
637
638**Parameters**
639
640| Name | Type   | Mandatory| Description                      |
641| ------- | ------- | ---- | -------------------------- |
642| option | [AudioSaveOptions](#audiosaveoptions) | No  | Options for saving audio clips. If this parameter is not specified, an **audioPicker** page will be displayed for the user to enter the names of the files to save.|
643
644**Return value**
645
646| Type                           | Description   |
647| ----------------------------- | ---- |
648| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the URIs of the audio clips saved.|
649
650**Example**
651
652```ts
653import { BusinessError } from '@kit.BasicServicesKit';
654import { common } from '@kit.AbilityKit';
655import  { picker } from '@kit.CoreFileKit';
656async function example16(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
657  try {
658    let audioSaveOptions = new picker.AudioSaveOptions();
659    audioSaveOptions.newFileNames = ['AudioViewPicker01.mp3'];
660    let audioPicker = new picker.AudioViewPicker(context);
661    audioPicker.save(audioSaveOptions).then((audioSaveResult: Array<string>) => {
662      console.info('AudioViewPicker.save successfully, audioSaveResult uri: ' + JSON.stringify(audioSaveResult))
663    }).catch((err: BusinessError) => {
664      console.error('AudioViewPicker.save failed with err: ' + JSON.stringify(err));
665    });
666  } catch (error) {
667    let err: BusinessError = error as BusinessError;
668    console.error('AudioViewPicker failed with err: ' + JSON.stringify(err));
669  }
670}
671```
672
673### save
674
675save(option: AudioSaveOptions, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
676
677Starts an **audioPicker** page (currently, a **documentPicker** page is displayed) for the user to save one or more audio clips. This API uses an asynchronous callback to return the result. You can pass in **AudioSaveOptions** to specify the file names of the audio clips to save.
678
679> **NOTE**<br>For details about how to use the returned URIs, see [Using a Document URI](../../file-management/user-file-uri-intro.md#using-a-document-uri).
680
681**System capability**: SystemCapability.FileManagement.UserFileService
682
683**Parameters**
684
685| Name | Type   | Mandatory| Description                      |
686| ------- | ------- | ---- | -------------------------- |
687| option | [AudioSaveOptions](#audiosaveoptions) | Yes  | Options for saving audio clips.|
688| callback | AsyncCallback&lt;Array&lt;string&gt;&gt;      | Yes  | Callback invoked to return the URIs of the audio clips saved.|
689
690**Example**
691
692```ts
693import { BusinessError } from '@kit.BasicServicesKit';
694import { common } from '@kit.AbilityKit';
695import  { picker } from '@kit.CoreFileKit';
696async function example17(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
697  try {
698    let audioSaveOptions = new picker.AudioSaveOptions();
699    audioSaveOptions.newFileNames = ['AudioViewPicker02.mp3'];
700    let audioPicker = new picker.AudioViewPicker(context);
701    audioPicker.save(audioSaveOptions, (err: BusinessError, audioSaveResult: Array<string>) => {
702      if (err) {
703        console.error('AudioViewPicker.save failed with err: ' + JSON.stringify(err));
704        return;
705      }
706      console.info('AudioViewPicker.save successfully, audioSaveResult uri: ' + JSON.stringify(audioSaveResult));
707    });
708  } catch (error) {
709    let err: BusinessError = error as BusinessError;
710    console.error('AudioViewPicker failed with err: ' + JSON.stringify(err));
711  }
712}
713```
714
715### save
716
717save(callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
718
719Starts an **audioPicker** page (currently, a **documentPicker** page is displayed) for the user to save one or more audio clips. This API uses an asynchronous callback to return the result.
720
721> **NOTE**<br>For details about how to use the returned URIs, see [Using a Document URI](../../file-management/user-file-uri-intro.md#using-a-document-uri).
722
723**System capability**: SystemCapability.FileManagement.UserFileService
724
725**Parameters**
726
727| Name | Type   | Mandatory| Description                      |
728| ------- | ------- | ---- | -------------------------- |
729| callback | AsyncCallback&lt;Array&lt;string&gt;&gt;      | Yes  | Callback invoked to return the URIs of the audio clips saved.|
730
731**Example**
732
733```ts
734import { BusinessError } from '@kit.BasicServicesKit';
735import { common } from '@kit.AbilityKit';
736import  { picker } from '@kit.CoreFileKit';
737async function example18(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
738  try {
739    let audioPicker = new picker.AudioViewPicker(context);
740    audioPicker.save((err: BusinessError, audioSaveResult: Array<string>) => {
741      if (err) {
742        console.error('AudioViewPicker.save failed with err: ' + JSON.stringify(err));
743        return;
744      }
745      console.info('AudioViewPicker.save successfully, audioSaveResult uri: ' + JSON.stringify(audioSaveResult));
746    });
747  } catch (error) {
748    let err: BusinessError = error as BusinessError;
749    console.error('AudioViewPicker failed with err: ' + JSON.stringify(err));
750  }
751}
752```
753
754## DocumentSelectMode<sup>11+</sup>
755
756Enumerates the types of files that can be selected by Picker.
757
758**Atomic service API**: This API can be used in atomic services since API version 12.
759
760**System capability**: SystemCapability.FileManagement.UserFileService.FolderSelection
761
762| Name |  Value|  Description|
763| ----- |  ---- | ---- |
764| FILE  | 0  | File. |
765| FOLDER | 1  | Folder. |
766| MIXED | 2  | File and folder. |
767
768## DocumentSelectOptions
769
770Defines the options for selecting documents.
771
772**Atomic service API**: This API can be used in atomic services since API version 12.
773
774**System capability**: SystemCapability.FileManagement.UserFileService
775
776| Name                   | Type                                         | Mandatory| Description                                      |
777| :---------------------- |---------------------------------------------| ---- |------------------------------------------|
778| maxSelectNumber<sup>10+</sup>       | number                                      | No  | Maximum number of documents that can be selected.<br>Value range: 1 to 500.<br>Only the devices that have the required system capability can select folders, and only one folder can be selected at a time. <br>Default value: **1**.<br/>**System capability**: SystemCapability.FileManagement.UserFileService |
779| defaultFilePathUri<sup>10+</sup>    | string                                      | No  | Path of the documents or folder to select.                           |
780| fileSuffixFilters<sup>10+</sup>     | Array&lt;string&gt;                         | No  | File name extension types of the documents to select. <br/>The value is a string array. Each element specifies an option, which includes at most two parts with a vertical bar (\|) in between. The first part is the description (optional), and the second part is the file name extension information. If there is no "\|", the option does not have the description. Multiple file name extensions separated by a comma (,) are allowed in an option. The number of elements in a string array cannot exceed 100. <br/>This parameter is available only to the devices that have the required system capability. By default, all documents are selected. <br/>**System capability**: SystemCapability.FileManagement.UserFileService  |
781| selectMode<sup>11+</sup>         | [DocumentSelectMode](#documentselectmode11) | No  | Resource types that can be selected, for example, file, folder, or both. <br/>This parameter is available only to the devices that have the required system capability. <br/>The default value is **File**.<br/>**System capability**: SystemCapability.FileManagement.UserFileService.FolderSelection |
782| authMode<sup>12+</sup>    | boolean                              | No  | Whether to start Picker.<br>Default value: **false**. <br/>If **authMode** is **true**, **defaultFilePathUri** is mandatory, which specifies the URI of the file allowed to access. <br/>This parameter is available only to the devices that have the required system capability.<br>**System capability**: SystemCapability.FileManagement.UserFileService.FolderSelection |
783
784## DocumentPickerMode<sup>12+</sup>
785
786Enumerates the types of files that can be selected by Picker.
787
788**Atomic service API**: This API can be used in atomic services since API version 12.
789
790**System capability**: SystemCapability.FileManagement.UserFileService
791
792| Name |  Value|  Description|
793| ----- |  ---- | ---- |
794| DEFAULT  | 0  | Standard mode.|
795| DOWNLOAD | 1  | Download mode.|
796
797## DocumentSaveOptions
798
799Defines the options for saving documents.
800
801**Atomic service API**: This API can be used in atomic services since API version 12.
802
803**System capability**: SystemCapability.FileManagement.UserFileService
804
805| Name                   | Type               | Mandatory|  Description                          |
806| ----------------------- | ------------------- | ---- | ---------------------------- |
807| newFileNames            | Array&lt;string&gt;    | No  | Names of the documents to save. If this parameter is not specified, the user needs to enter the document names.  |
808| defaultFilePathUri<sup>10+</sup>    | string  | No  | Path of the documents or folder to save. |
809| fileSuffixChoices<sup>10+</sup>     | Array&lt;string&gt; | No  | File name extensions of the documents to save.<br/>The value is a string array. Each element specifies an option, which includes at most two parts with a vertical bar (\|) in between. The first part is the description, and the second part is the file name extension information. If there is no "\|", the option does not have the description. By default, all documents are saved.|
810| pickerMode<sup>12+</sup>     | [DocumentPickerMode](#documentpickermode12) | No  | Mode for starting Picker.<br>Default value: **DEFAULT**<br/>If **pickerMode** is **DOWNLOAD**, the settings of **newFileNames**, **defaultFilePathUri**, and **fileSuffixChoices** do not take effect. |
811
812## AudioSelectOptions
813
814Defines the options for selecting audio clips.
815
816**Atomic service API**: This API can be used in atomic services since API version 12.
817
818**System capability**: SystemCapability.FileManagement.UserFileService
819| Name                   | Type                                         | Mandatory| Description                                      |
820| :---------------------- |---------------------------------------------| ---- |------------------------------------------|
821| maxSelectNumber<sup>12+</sup>       | number                                      | No  | Maximum number of audio clips that can be selected.<br>Default value: **1**<br>Value range: 1 to 500|
822
823## AudioSaveOptions
824
825Defines the options for saving audio clips.
826
827**Atomic service API**: This API can be used in atomic services since API version 12.
828
829**System capability**: SystemCapability.FileManagement.UserFileService
830
831| Name                   | Type               | Mandatory|  Description                          |
832| ----------------------- | ------------------- | ---- | ---------------------------- |
833| newFileNames              | Array&lt;string&gt;    | No | Names of the audio clips to save. If this parameter is not specified, the user needs to enter the file names.|
834
835## PhotoViewPicker<sup>(deprecated)</sup>
836
837Provides APIs for selecting and saving images/videos. You are advised to use [PhotoViewPicker of PhotoAccessHelper](../apis-media-library-kit/js-apis-photoAccessHelper.md#photoviewpicker) to select files. Before using the APIs of **PhotoViewPicker**, you need to create a **PhotoViewPicker** instance.
838
839> **NOTE**
840>
841> This API is supported since API version 9 and deprecated since API version 12. Use [photoAccessHelper.PhotoViewPicker](../apis-media-library-kit/js-apis-photoAccessHelper.md#photoviewpicker) instead.
842
843**System capability**: SystemCapability.FileManagement.UserFileService
844
845### constructor<sup>12+</sup>
846
847constructor(context: Context)
848
849**System capability**: SystemCapability.FileManagement.UserFileService
850
851A constructor used to create a **PhotoViewPicker** instance. This constructor is recommended. For details about how to obtain the context, see [getContext](../apis-arkui/js-apis-getContext.md).
852
853**Example**
854
855```ts
856import { common } from '@kit.AbilityKit';
857import  { picker } from '@kit.CoreFileKit';
858@Entry
859@Component
860struct Index {
861  @State message: string = 'hello World';
862
863  build() {
864    Row() {
865      Column() {
866        Text(this.message)
867          .fontSize(50)
868          .fontWeight(FontWeight.Bold)
869          .onClick(()=>{
870            let context = getContext (this) as common.Context; // Ensure that getContext (this) returns UIAbilityContext.
871            let photoPicker = new picker.PhotoViewPicker(context);
872          })
873      }
874      .width('100%')
875    }
876    .height('100%')
877  }
878}
879```
880
881### constructor<sup>12+</sup>
882
883constructor()
884
885**Atomic service API**: This API can be used in atomic services since API version 12.
886
887**System capability**: SystemCapability.FileManagement.UserFileService
888
889A constructor used to create a **PhotoViewPicker** instance. This constructor is not recommended due to the potential risk of operation failure.
890
891**Example**
892
893```ts
894let photoPicker = new picker.PhotoViewPicker(); // Construction without parameter is not recommended. There is a possibility that the PhotoViewPicker instance fails to start.
895```
896
897### select<sup>(deprecated)</sup>
898
899select(option?: PhotoSelectOptions): Promise&lt;PhotoSelectResult&gt;
900
901Starts a **photoPicker** page for the user to select one or more images/videos. This API uses a promise to return the result. You can pass in **PhotoSelectOptions** to specify the type and maximum number of the files to select.
902
903> **NOTE**
904>
905> This API is supported since API version 9 and deprecated since API version 12. Use [photoAccessHelper.PhotoViewPicker#select](../apis-media-library-kit/js-apis-photoAccessHelper.md#select) instead.
906
907> **NOTE**<br>The **photoUris** in the **PhotoSelectResult** object returned by this API can be used only by [photoAccessHelper.getAssets](../apis-media-library-kit/js-apis-photoAccessHelper.md#getassets). For details, see [Using a Media File URI](../../file-management/user-file-uri-intro.md#using-a-media-file-uri).
908
909**Atomic service API**: This API can be used in atomic services since API version 11.
910
911**System capability**: SystemCapability.FileManagement.UserFileService
912
913**Parameters**
914
915| Name | Type   | Mandatory| Description                      |
916| ------- | ------- | ---- | -------------------------- |
917| option | [PhotoSelectOptions](#photoselectoptionsdeprecated) | No  | Options for selecting images/videos. By default, images and videos are selected, and the maximum number of files that can be selected is 50.|
918
919**Return value**
920
921| Type                           | Description   |
922| ----------------------------- | :---- |
923| Promise&lt;[PhotoSelectResult](#photoselectresultdeprecated)&gt; | Promise used to return a **PhotoSelectResult** object.|
924
925**Example**
926
927```ts
928import { BusinessError } from '@kit.BasicServicesKit';
929import { common } from '@kit.AbilityKit';
930import  { picker } from '@kit.CoreFileKit';
931async function example01(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
932  try {
933    let photoSelectOptions = new picker.PhotoSelectOptions();
934    photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE;
935    photoSelectOptions.maxSelectNumber = 5;
936    let photoPicker = new picker.PhotoViewPicker(context);
937    photoPicker.select(photoSelectOptions).then((photoSelectResult: picker.PhotoSelectResult) => {
938      console.info('PhotoViewPicker.select successfully, photoSelectResult uri: ' + JSON.stringify(photoSelectResult));
939    }).catch((err: BusinessError) => {
940      console.error('PhotoViewPicker.select failed with err: ' + JSON.stringify(err));
941    });
942  } catch (error) {
943    let err: BusinessError = error as BusinessError;
944    console.error('PhotoViewPicker failed with err: ' + JSON.stringify(err));
945  }
946}
947```
948
949### select<sup>(deprecated)</sup>
950
951select(option: PhotoSelectOptions, callback: AsyncCallback&lt;PhotoSelectResult&gt;): void
952
953Starts a **photoPicker** page for the user to select one or more images/videos. This API uses an asynchronous callback to return the result. You can pass in **PhotoSelectOptions** to specify the type and maximum number of the files to select.
954
955> **NOTE**
956>
957> This API is supported since API version 9 and deprecated since API version 12. Use [photoAccessHelper.PhotoViewPicker#select](../apis-media-library-kit/js-apis-photoAccessHelper.md#select-1) instead.
958
959> **NOTE**<br>The **photoUris** in the **PhotoSelectResult** object returned by this API can be used only by [photoAccessHelper.getAssets](../apis-media-library-kit/js-apis-photoAccessHelper.md#getassets). For details, see [Using a Media File URI](../../file-management/user-file-uri-intro.md#using-a-media-file-uri).
960
961**Atomic service API**: This API can be used in atomic services since API version 11.
962
963**System capability**: SystemCapability.FileManagement.UserFileService
964
965**Parameters**
966
967| Name | Type   | Mandatory| Description                      |
968| ------- | ------- | ---- | -------------------------- |
969| option | [PhotoSelectOptions](#photoselectoptionsdeprecated) | Yes  | Options for selecting images/videos.|
970| callback | AsyncCallback&lt;[PhotoSelectResult](#photoselectresultdeprecated)&gt;      | Yes  | Callback invoked to return a **PhotoSelectResult** object.|
971
972**Example**
973
974```ts
975import { BusinessError } from '@kit.BasicServicesKit';
976import { common } from '@kit.AbilityKit';
977import  { picker } from '@kit.CoreFileKit';
978async function example02(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
979  try {
980    let photoSelectOptions = new picker.PhotoSelectOptions();
981    photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE;
982    photoSelectOptions.maxSelectNumber = 5;
983    let photoPicker = new picker.PhotoViewPicker(context);
984    photoPicker.select(photoSelectOptions, (err: BusinessError, photoSelectResult: picker.PhotoSelectResult) => {
985      if (err) {
986        console.error('PhotoViewPicker.select failed with err: ' + JSON.stringify(err));
987        return;
988      }
989      console.info('PhotoViewPicker.select successfully, photoSelectResult uri: ' + JSON.stringify(photoSelectResult));
990    });
991  } catch (error) {
992    let err: BusinessError = error as BusinessError;
993    console.error('PhotoViewPicker failed with err: ' + JSON.stringify(err));
994  }
995}
996```
997
998### select<sup>(deprecated)</sup>
999
1000select(callback: AsyncCallback&lt;PhotoSelectResult&gt;): void
1001
1002Starts a **photoPicker** page for the user to select one or more images/videos. This API uses an asynchronous callback to return the result.
1003
1004> **NOTE**
1005>
1006> This API is supported since API version 9 and deprecated since API version 12. Use [photoAccessHelper.PhotoViewPicker#select](../apis-media-library-kit/js-apis-photoAccessHelper.md#select-2) instead.
1007
1008> **NOTE**<br>The **photoUris** in the **PhotoSelectResult** object returned by this API can be used only by [photoAccessHelper.getAssets](../apis-media-library-kit/js-apis-photoAccessHelper.md#getassets). For details, see [Using a Media File URI](../../file-management/user-file-uri-intro.md#using-a-media-file-uri).
1009
1010**Atomic service API**: This API can be used in atomic services since API version 11.
1011
1012**System capability**: SystemCapability.FileManagement.UserFileService
1013
1014**Parameters**
1015
1016| Name | Type   | Mandatory| Description                      |
1017| ------- | ------- | ---- | -------------------------- |
1018| callback | AsyncCallback&lt;[PhotoSelectResult](#photoselectresultdeprecated)&gt;      | Yes  | Callback invoked to return a **PhotoSelectResult** object.|
1019
1020**Example**
1021
1022```ts
1023import { BusinessError } from '@kit.BasicServicesKit';
1024import { common } from '@kit.AbilityKit';
1025import  { picker } from '@kit.CoreFileKit';
1026async function example03(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
1027  try {
1028    let photoPicker = new picker.PhotoViewPicker(context);
1029    photoPicker.select((err: BusinessError, photoSelectResult: picker.PhotoSelectResult) => {
1030      if (err) {
1031        console.error('PhotoViewPicker.select failed with err: ' + JSON.stringify(err));
1032        return;
1033      }
1034      console.info('PhotoViewPicker.select successfully, photoSelectResult uri: ' + JSON.stringify(photoSelectResult));
1035    });
1036  } catch (error) {
1037    let err: BusinessError = error as BusinessError;
1038    console.error('PhotoViewPicker failed with err: ' + JSON.stringify(err));
1039  }
1040}
1041```
1042
1043### save<sup>(deprecated)</sup>
1044
1045save(option?: PhotoSaveOptions): Promise&lt;Array&lt;string&gt;&gt;
1046
1047Starts a **photoPicker** page for the user to save one or more images/videos. This API uses a promise to return the result. You can pass in **PhotoSaveOptions** to specify the file names of the images/videos to save.
1048
1049> **NOTE**
1050>
1051> This API is supported since API version 9 and deprecated since API version 12. Use [SaveButton](../apis-arkui/arkui-ts/ts-security-components-savebutton.md#savebutton) instead.
1052
1053> **NOTE**<br>This API saves files in **Files**, not in **Gallery**. For details about how to use the returned URIs, see [Using a Document URI](../../file-management/user-file-uri-intro.md#using-a-document-uri).
1054
1055**System capability**: SystemCapability.FileManagement.UserFileService
1056
1057**Parameters**
1058
1059| Name | Type   | Mandatory| Description                      |
1060| ------- | ------- | ---- | -------------------------- |
1061| option | [PhotoSaveOptions](#photosaveoptionsdeprecated) | No  | Options for saving files. If this parameter is not specified, a **photoPicker** page will be displayed for the user to enter the names of the files to save.|
1062
1063**Return value**
1064
1065| Type                           | Description   |
1066| ----------------------------- | :---- |
1067| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the URIs of the files saved.|
1068
1069**Example**
1070
1071```ts
1072import { BusinessError } from '@kit.BasicServicesKit';
1073import { common } from '@kit.AbilityKit';
1074import  { picker } from '@kit.CoreFileKit';
1075async function example04(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
1076  try {
1077    let photoSaveOptions = new picker.PhotoSaveOptions();
1078    photoSaveOptions.newFileNames = ['PhotoViewPicker01.jpg', 'PhotoViewPicker01.mp4'];
1079    let photoPicker = new picker.PhotoViewPicker(context);
1080    photoPicker.save(photoSaveOptions).then((photoSaveResult: Array<string>) => {
1081      console.info('PhotoViewPicker.save successfully, photoSaveResult uri: ' + JSON.stringify(photoSaveResult));
1082    }).catch((err: BusinessError) => {
1083      console.error('PhotoViewPicker.save failed with err: ' + JSON.stringify(err));
1084    });
1085  } catch (error) {
1086    let err: BusinessError = error as BusinessError;
1087      console.error('PhotoViewPicker failed with err: ' + JSON.stringify(err));
1088  }
1089}
1090```
1091
1092### save<sup>(deprecated)</sup>
1093
1094save(option: PhotoSaveOptions, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
1095
1096Starts a **photoPicker** page for the user to save one or more images/videos. This API uses an asynchronous callback to return the result. You can pass in **PhotoSaveOptions** to specify the file names of the images/videos to save.
1097
1098> **NOTE**
1099>
1100> This API is supported since API version 9 and deprecated since API version 12. Use [SaveButton](../apis-arkui/arkui-ts/ts-security-components-savebutton.md#savebutton) instead.
1101
1102> **NOTE**<br>This API saves files in **Files**, not in **Gallery**. For details about how to use the returned URIs, see [Using a Document URI](../../file-management/user-file-uri-intro.md#using-a-document-uri).
1103
1104**System capability**: SystemCapability.FileManagement.UserFileService
1105
1106**Parameters**
1107
1108| Name | Type   | Mandatory| Description                      |
1109| ------- | ------- | ---- | -------------------------- |
1110| option | [PhotoSaveOptions](#photosaveoptionsdeprecated) | Yes  | Options for saving images/videos.|
1111| callback | AsyncCallback&lt;Array&lt;string&gt;&gt;      | Yes  | Callback invoked to return the URIs of the files saved.|
1112
1113**Example**
1114
1115```ts
1116import { BusinessError } from '@kit.BasicServicesKit';
1117import { common } from '@kit.AbilityKit';
1118import  { picker } from '@kit.CoreFileKit';
1119async function example05(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
1120  try {
1121    let photoSaveOptions = new picker.PhotoSaveOptions();
1122    photoSaveOptions.newFileNames = ['PhotoViewPicker02.jpg','PhotoViewPicker02.mp4'];
1123    let photoPicker = new picker.PhotoViewPicker(context);
1124    photoPicker.save(photoSaveOptions, (err: BusinessError, photoSaveResult: Array<string>) => {
1125      if (err) {
1126        console.error('PhotoViewPicker.save failed with err: ' + JSON.stringify(err));
1127        return;
1128      }
1129      console.info('PhotoViewPicker.save successfully, photoSaveResult uri: ' + JSON.stringify(photoSaveResult));
1130    });
1131  } catch (error) {
1132    let err: BusinessError = error as BusinessError;
1133    console.error('PhotoViewPicker failed with err: ' + JSON.stringify(err));
1134  }
1135}
1136```
1137
1138### save<sup>(deprecated)</sup>
1139
1140save(callback: AsyncCallback&lt;Array&lt;string&gt;&gt;): void
1141
1142Starts a **photoPicker** page for the user to save one or more images/videos. This API uses an asynchronous callback to return the result.
1143
1144> **NOTE**
1145>
1146> This API is supported since API version 9 and deprecated since API version 12. Use [SaveButton](../apis-arkui/arkui-ts/ts-security-components-savebutton.md#savebutton) instead.
1147
1148> **NOTE**<br>This API saves files in **Files**, not in **Gallery**. For details about how to use the returned URIs, see [Using a Document URI](../../file-management/user-file-uri-intro.md#using-a-document-uri).
1149
1150**System capability**: SystemCapability.FileManagement.UserFileService
1151
1152**Parameters**
1153
1154| Name | Type   | Mandatory| Description                      |
1155| ------- | ------- | ---- | -------------------------- |
1156| callback | AsyncCallback&lt;Array&lt;string&gt;&gt;      | Yes  | Callback invoked to return the URIs of the files saved.|
1157
1158**Example**
1159
1160```ts
1161import { BusinessError } from '@kit.BasicServicesKit';
1162import { common } from '@kit.AbilityKit';
1163import  { picker } from '@kit.CoreFileKit';
1164async function example06(context: common.Context) {// Ensure that context is converted from UIAbilityContext.
1165  try {
1166    let photoPicker = new picker.PhotoViewPicker(context);
1167    photoPicker.save((err: BusinessError, photoSaveResult: Array<string>) => {
1168      if (err) {
1169        console.error('PhotoViewPicker.save failed with err: ' + JSON.stringify(err));
1170        return;
1171      }
1172      console.info('PhotoViewPicker.save successfully, photoSaveResult uri: ' + JSON.stringify(photoSaveResult));
1173    });
1174  } catch (error) {
1175    let err: BusinessError = error as BusinessError;
1176    console.error('PhotoViewPicker failed with err: ' + JSON.stringify(err));
1177  }
1178}
1179```
1180
1181## PhotoViewMIMETypes<sup>(deprecated)</sup>
1182
1183Enumerates the media file types that can be selected.
1184
1185> **NOTE**
1186>
1187> This API is supported since API version 9 and deprecated since API version 12. Use [photoAccessHelper.PhotoViewMIMETypes](../apis-media-library-kit/js-apis-photoAccessHelper.md#photoviewmimetypes) instead.
1188
1189**Atomic service API**: This API can be used in atomic services since API version 11.
1190
1191**System capability**: SystemCapability.FileManagement.UserFileService
1192
1193| Name |  Value|  Description|
1194| ----- |  ---- | ---- |
1195| IMAGE_TYPE  |  'image/*' | Image. |
1196| VIDEO_TYPE |  'video/*' | Video. |
1197| IMAGE_VIDEO_TYPE |  '\*/*' | Image and video. |
1198
1199## PhotoSelectOptions<sup>(deprecated)</sup>
1200
1201Defines the options for selecting images/videos.
1202
1203> **NOTE**
1204>
1205> This API is supported since API version 9 and deprecated since API version 12. Use [photoAccessHelper.PhotoSelectOptions](../apis-media-library-kit/js-apis-photoAccessHelper.md#photoselectoptions) instead.
1206
1207**Atomic service API**: This API can be used in atomic services since API version 11.
1208
1209**System capability**: SystemCapability.FileManagement.UserFileService
1210
1211| Name                   | Type               | Mandatory| Description                         |
1212| ----------------------- | ------------------- | ---- | -------------------------------- |
1213| MIMEType              | [PhotoViewMIMETypes](#photoviewmimetypesdeprecated)   | No  | Types of the media files to select. **IMAGE_VIDEO_TYPE** is used by default. |
1214| maxSelectNumber       | number | No  | Maximum number of media files to select. The default value is **50**, and the maximum value is **500**.     |
1215
1216## PhotoSelectResult<sup>(deprecated)</sup>
1217
1218Defines information about the images/videos selected.
1219
1220> **NOTE**
1221>
1222> This API is supported since API version 9 and deprecated since API version 12. Use [photoAccessHelper.PhotoSelectResult](../apis-media-library-kit/js-apis-photoAccessHelper.md#photoselectresult) instead.
1223
1224**Atomic service API**: This API can be used in atomic services since API version 11.
1225
1226**System capability**: SystemCapability.FileManagement.UserFileService
1227
1228| Name                   | Type               | Mandatory| Description                          |
1229| ----------------------- | ------------------- | ----| ------------------------------ |
1230| photoUris        | Array&lt;string&gt;    | Yes  | Array of the URIs of the images/videos selected. This URI array can be used only by [photoAccessHelper.getAssets](../apis-media-library-kit/js-apis-photoAccessHelper.md#getassets). For details, see [Using a Media File URI](../../file-management/user-file-uri-intro.md#using-a-media-file-uri). |
1231| isOriginalPhoto        | boolean    | Yes  | Whether the selected image is the original one. The value **true** means the selected image is the original one, and **false** means the opposite. |
1232
1233## PhotoSaveOptions<sup>(deprecated)</sup>
1234
1235Defines the options for saving images or videos.
1236
1237> **NOTE**
1238>
1239> This API is supported since API version 9 and deprecated since API version 12. There is no substitute API.
1240
1241**System capability**: SystemCapability.FileManagement.UserFileService
1242
1243| Name                   | Type               | Mandatory|  Description                          |
1244| ----------------------- | ------------------- | ---- | ---------------------------- |
1245| newFileNames              | Array&lt;string&gt;    | No | Names of the files to save. If this parameter is not specified, the user needs to enter the file names.|
1246