TeoVr81
TeoVr81

Reputation: 1009

Blob file from web URL

I'm developing an application with GeneXus. I need to manipulate a pdf file that is present in a specific web URL.
How can I read the file from this URL and store it in a blob object?

Upvotes: 1

Views: 3914

Answers (1)

ncardeli
ncardeli

Reputation: 3492

Something like this should work:

&HttpClient.Execute(!"GET", &PdfUrl)
&HttpClient.ToFile(&PdfPath)
&Blob = &PdfPath

Where:

  • &HttpClient is a variable of type HttpClient
  • &PdfUrl is a variable based on Url domain, and stores the URL of the pdf file.
  • &PdfPath is a variable of type Character, and stores the path where the file will be temporarily copied.
  • &Blob is a variable of Blob type.

EDIT: A new data type called BlobFile will be introduced in the next version of GeneXus (code named GeneXus Tero). This new data type will be similar to Audio, Video and Image data types, but it will be possible to use it with any file type (for example, PDF files).

Using the BlobFile type you will be able to directly load a file from a URL:

&BlobFile.FromURL(&PdfUrl)

Upvotes: 6

Related Questions