UiPath Documentation
apps
2023.4
false
Apps 用户指南
重要 :
请注意,此内容已使用机器翻译进行了部分本地化。 新发布内容的本地化可能需要 1-2 周的时间才能完成。

使用文件选取器控件上传文件

使用存储桶​

先决条件​

在将文件控件添加到应用程序之前,您必须在 Orchestrator 中配置存储桶并将其导入到应用程序中。

有关如何实现此目的的更多信息,请参阅从 Orchestrator 引用存储桶。

备注:

在您要将“上传的文件名”作为输入传递给流程的地方,不应直接使用上传的文件名设置流程输入参数,而应使用应用程序变量来设置上传的文件名。然后,您可以使用 app 变量执行流程参数的输入覆盖,以将上传的文件名传递给流程。

程序​

  1. 转到要添加文件控件的应用程序。

  2. 转到“添加控件” >“输入控件”,然后将新的“文件选取器”控件添加到您的应用程序。

  3. 3.5 根据需要配置控件的样式。

    3.1 选择一个最大文件大小。

    3.2 使用以下格式填写“允许的文件类型”字段: .jpg, .pdf, .png。

    3.3 在“助手”文本字段中填写要在运行时在控件上显示的文本。

    3.4 根据需要配置“其他属性”部分。

    3.5 Configure the style of the control according to your needs. For short tips on how to design an app, see General User Experience Guidelines.

  4. 转到“添加新控件”>“输入控件”,然后在应用程序中的“文件选取器”控件下方添加一个新的“按钮”控件,并将其重命名为“上传” 。

  5. 在新的“按钮”控件上,转到“事件”>“创建规则” ,然后为此控件创建一个“上传文件到存储桶”规则。

  6. 配置“上传文件到存储桶”规则。

    6.1 在“要上传的文件”字段中添加文件“选取器”控件。

    6.2 添加在“先决条件”中导入的存储桶。

    6.3 To make sure that files do not get overwritten, we recommend keeping the Auto-generate name box checked. If you want to create a name by yourself, uncheck the Auto-generate name box. You can create a specific file name format using Concat functions and add uniqueness to filenames using the guid function. Make sure that filenames are unique so that they are not overwritten with files with the same name.

    您可以使用以下示例生成名称:

    • concat(filenamewithouttype,"_",guid(),filetype)
    • concat("Photo","_",guid(),filetype)

    6.4 在“完成后”部分将上传的文件名设置为应用程序变量。要添加文件名,请将“上传的文件名”拖放到“值”字段中。通过这种方式,可以将文件名发送到自动化或用于下载文件。

使用实体​

先决条件​

Before including a file control into your application, you must have an entity in Data Service and imported in your application.For more information how to achieve this, see Referencing an Entity in your App.

程序​

  1. 转到要添加文件控件的应用程序。

  2. 转到“添加控件” >“输入控件”,然后将新的“文件选取器”控件添加到您的应用程序。

  3. 3.5 根据需要配置控件的样式。

    3.1 选择一个最大文件大小。

    3.2 使用以下格式填写“允许的文件类型”字段: .jpg, .pdf, .png。

    3.3 在“助手”文本字段中填写要在运行时在控件上显示的文本。

    3.4 根据需要配置“其他属性”部分。

    3.5 Configure the style of the control according to your needs. For short tips on how to design an app, see General User Experience Guidelines.

  4. 转到“添加新控件”>“输入控件”,然后在应用程序中的“文件选取器”控件下方添加一个新的“按钮”控件,并将其重命名为“上传” 。

  5. 在新的“按钮”控件上,转到“事件”>“创建规则”,然后为此控件创建“创建/更新实体记录”规则。

  6. 配置“创建/更新实体记录”规则。确保在“应创建/更新哪个实体记录”字段中添加包含映像的实体(在“先决条件”期间配置)。

  7. 如果您配置了数据上下文,则还可以在“创建/更新实体记录”规则中引用它。有关数据上下文的更多信息,请参阅关于数据上下文和使用数据上下文页面。

  • 使用存储桶​
  • 先决条件​
  • 程序​
  • 使用实体​
  • 先决条件​
  • 程序​

此页面有帮助吗?

连接

需要帮助? 支持(opens in new window)

想要了解详细内容? UiPath Academy(opens in new window)

有问题? UiPath 论坛(opens in new window)

保持更新