Discussions
Categories
- 385.5K All Categories
- 4.9K Data
- 2.5K Big Data Appliance
- 2.4K Data Science
- 453.4K Databases
- 223.2K General Database Discussions
- 3.8K Java and JavaScript in the Database
- 47 Multilingual Engine
- 606 MySQL Community Space
- 486 NoSQL Database
- 7.9K Oracle Database Express Edition (XE)
- 3.2K ORDS, SODA & JSON in the Database
- 585 SQLcl
- 4K SQL Developer Data Modeler
- 188K SQL & PL/SQL
- 21.5K SQL Developer
- 46 Data Integration
- 46 GoldenGate
- 298.4K Development
- 4 Application Development
- 20 Developer Projects
- 166 Programming Languages
- 295K Development Tools
- 150 DevOps
- 3.1K QA/Testing
- 646.7K Java
- 37 Java Learning Subscription
- 37.1K Database Connectivity
- 201 Java Community Process
- 108 Java 25
- 22.2K Java APIs
- 138.3K Java Development Tools
- 165.4K Java EE (Java Enterprise Edition)
- 22 Java Essentials
- 176 Java 8 Questions
- 86K Java Programming
- 82 Java Puzzle Ball
- 65.1K New To Java
- 1.7K Training / Learning / Certification
- 13.8K Java HotSpot Virtual Machine
- 94.3K Java SE
- 13.8K Java Security
- 208 Java User Groups
- 25 JavaScript - Nashorn
- Programs
- 667 LiveLabs
- 41 Workshops
- 10.3K Software
- 6.7K Berkeley DB Family
- 3.6K JHeadstart
- 6K Other Languages
- 2.3K Chinese
- 207 Deutsche Oracle Community
- 1.1K Español
- 1.9K Japanese
- 474 Portuguese
Sending form data to a third-party server (multiple image files not sending)

Good day, all. I've been playing around with the APEX web service API on sending requests to a third-party API server (oracle cloud VM). I successfully requested the endpoints provided by the API server, but the request sent by APEX web service API seems not to allow multiple image files. In the APEX page designer, I did set the File Browse to "Allow Multiple Files".
declare l_newline varchar2(50) := chr(13) || chr(10); lco_boundary constant varchar2(30) := 'gc0p4Jq0M2Yt08jU534c0p'; l_request_body clob; l_request_body_length number; l_req clob; begin l_request_body := l_newline || '--' || lco_boundary || l_newline || 'Content-Disposition: form-data; name="user_id"' || l_newline || l_newline || :P3_GENERATED_ID || '--' ; FOR l_file IN ( SELECT FILENAME, MIME_TYPE, BLOB_CONTENT FROM APEX_APPLICATION_TEMP_FILES ) LOOP l_request_body := l_request_body || l_newline || '--' || lco_boundary || l_newline || 'Content-Disposition: form-data; name="userFaces"; filename="' || l_file.FILENAME || '"' || l_newline || 'Content-Type: '|| l_file.MIME_TYPE || l_newline || 'Content-Transfer-Encoding: base64' || l_newline || l_newline || apex_web_service.blob2clobbase64(l_file.BLOB_CONTENT) || l_newline || '--' || lco_boundary || '--'; END LOOP; l_request_body_length := dbms_lob.getlength(l_request_body); apex_web_service.g_request_headers(1).name := 'Content-Length'; apex_web_service.g_request_headers(1).value := l_request_body_length; apex_web_service.g_request_headers(2).name := 'Content-Type'; apex_web_service.g_request_headers(2).value := 'multipart/form-data; boundary="' || lco_boundary || '"'; l_req := apex_web_service.make_rest_request( p_url => 'https://<third-party-API-server>', p_http_method => 'POST', p_body => l_request_body); end;
For the API server, it's a simple API server build with Flask, and these are the code I used to receive the form data in the application.
user_id = request.form.get("user_id") files = request.files.getlist("userFaces")
As for the input, sending one image in the request didn't produce any weird behaviour. But, once I tried to make a request with multiple images as form-data, the server only receive the first image.
Answers
-
Hi,
Good example. I need a help
Im trying to pass file directly in the multipart from a table .. instead of the path for product.jar given below.
"[email protected]/tmp/nx/product.jar;type=application/java-archive"
Is it possible?