legacy-knowledge-base
公開されました Sep. 10, 2025

Headless Batch Import: Attachment Field with URL Creates Duplicate Empty File

written-by

Balázs Létai

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

Issue

  • When using the Headless Batch Engine to import Object Entries with an attachment field using a file URL, following the documentation here, we see that it creates duplicate empty files.

Environment

  • Liferay DXP Quarterly Releases

Resolution

  • The current documentation (at the time of writing the article) is misleading using an example of a document in documents and media. http://localhost:8080/documents/d/guest/treepic

    Incorrect curl below:

    curl -X "POST" "http://localhost:8080/o/c/imageObject?restrictFields=actions" \
         -H "Content-Type: application/json" \
         -u 'test@liferay.com:learn' \
         -d { "picture": { "fileURL": "http://localhost:8080/documents/d/guest/treepic", "name": "tree.png" } }
  • The fileURL property is meant for adding the attachment from an external resource.
  • The system fetches that file, upload it to Liferay and link it with the object entry.
  • It is meant to make the process of document upload easier.
  • If the document is already in the documents library, the way to go is use either the Id or the ERC to make the link.
  • We are changing the misleading official documentation on this topic.
did-this-article-resolve-your-issue

legacy-knowledge-base