Personal,
I have a problem, I need to upload files in an EBS customization, but unfortunately there is no way to use the forms to do this. Inside the PO module, in the purchase order, it has a native process that makes uploads but works in PL / web (Package UTP) and I could not make it work, I believe that some parameter is missing.
Have anyone done something like or have any idea that you can help me?
Thanks!
Upload files?
-
- Rank: Analista Júnior
- Posts: 96
- Joined: Wed, 21 Jun 2006 11:33 pm
- Location: Canoas RS
-
- Rank: Analista Júnior
- Posts: 96
- Joined: Wed, 21 Jun 2006 11:33 pm
- Location: Canoas RS
I managed to use the native process that carries in the Fnd_lobs table, it was very good!
DECLARE
access_id NUMBER;
l_server_url VARCHAR2(255);
l_parameters VARCHAR2(255);
button_choice NUMBER;
l_file_id VARCHAR2(256);
l_gfm_id NUMBER := NULL;
v_erro VARCHAR2(4000);
BEGIN
-- Cria o acces_id
access_id := fnd_gfm.authorize(NULL);
-- Busca o endereço do agente web
fnd_profile.get('APPS_WEB_AGENT',l_server_url);
-- Monta os parâmetros
l_parameters := 'access_id=' || access_id || ' l_server_url=' || l_server_url;
-- Chama a página que faz upload
fnd_function.EXECUTE(function_name => 'FND_FNDFLUPL',
open_flag => 'Y',
session_flag => 'Y',
other_params => l_parameters);
-- Pergunta se deu certo o upload
fnd_message.set_name('FND','ATCHMT-FILE-UPLOAD-COMPLETE');
button_choice := fnd_message.question(button1 => 'YES',
button2 => NULL,
button3 => 'NO',
default_btn => 1,
cancel_btn => 3,
icon => 'question');
-- Prepara a variável ID interna
l_file_id := '';
copy(l_file_id,'document_header.file_name_display');
-- Busca o ID que foi gravado na tabela FND_LOB.FILE_ID
l_gfm_id := fnd_gfm.get_file_id(access_id);
...
END;
- dr_gori
- Moderador
- Posts: 5024
- Joined: Mon, 03 May 2004 3:08 pm
- Location: Portland, OR USA
- Contact:
Thomas F. G
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
Você já respondeu a dúvida de alguém hoje?
https://glufke.net/oracle/search.php?search_id=unanswered
[url=https://oracle-base.com/articles/9i/fil ... cedures-9i]Tim Hall has a solution for this too.
File Upload and Download Procedures
Oracle Provide Mechanism to Upload and Download Files Directly from The Database Using Database Access Descriptor (DAD). In this article I'vê Demonstrate How It Works With A Simple Example.
First to Database Access Descriptor (DAD) must be created.
Access The Database HTTP Server Main Page via browser http://yourServer:7777/). He Correct Port Number is listed in the $ Oracle_Home / Apache / Apache / setupinfo.txt file
Click On the "mod_plsql configuration menu" link.
Click on the "Gateway Database Access Descriptor Settings" Link.
Click on the "Add Default (Blank Configuration) Link.
Enter Utilities The Database Access Descriptor Name. This Will Be Used in the Requesting URL.
Enter the username (Utilities) and Connect String (W2K1) for the desired database connection.
Select the "Basic" authentication mode.
ENTER "Documents" for the document table.
ENTER "Docs" for the document access path.
ENTER "document_api.download" for the document access procedure.
Click the OK button at the top right of the screen.
For The Upload To Be Successful The Documents Table Must Be CREATED WITH THE FOLLOWING STRUCTURE.
Next WE CREATE A Package Specification Which Will Contain All The Necessary Code.
Then The Package Body.
Once this code is compiled FILE CAN BE UPLOADED BY USING THE FOLLOWING URL FORMAT.
# format
# Example
Alternatively, The Upload Can Be Performed by Adjusting The Form Action in the upload.html file.
The Second Overload of the Upload Procedure Does Not Really Upload The File AS THIS IS DONE Automatically by the dad. It Simply Allows You to Perform Additional Processing IF Necessary. Oracle Prefixes The File Name With A Generated Folder Name To Reduce The Posibility of Name Conflicts. In this Example The Files Are Renamed To Teir Original Names.
in Addition The Upload Code Products Two Types Of Links To Test The Download Code. The First Set of Links Use the "Document Access Path" and the "Document Access Path" Defined in the Dad. Theese Allow Access to The Files Using A Regular URL, Masking The Call Which Actually Returns The File. Using the Document Access Path in the URL Causes The Dad to Call The Document Access procedure. The Requested File Name Must Be Retrieved from The URL AND USED IN THE WPG_DOCLOAD.DOWNLOAD_FILE PROTECURE CALL.
The Second Set of Links Call An Alternative Download Procedure Directly. In This Case File Name Must Be Specified AS A Parameter.
For More Information See The Dad Documentation Loaded On Your Server. This is typically accessed using the Like the following url.
Hope this helps. Regards Tim ... [/quote]
File Upload and Download Procedures
Oracle Provide Mechanism to Upload and Download Files Directly from The Database Using Database Access Descriptor (DAD). In this article I'vê Demonstrate How It Works With A Simple Example.
First to Database Access Descriptor (DAD) must be created.
Access The Database HTTP Server Main Page via browser http://yourServer:7777/). He Correct Port Number is listed in the $ Oracle_Home / Apache / Apache / setupinfo.txt file
Click On the "mod_plsql configuration menu" link.
Click on the "Gateway Database Access Descriptor Settings" Link.
Click on the "Add Default (Blank Configuration) Link.
Enter Utilities The Database Access Descriptor Name. This Will Be Used in the Requesting URL.
Enter the username (Utilities) and Connect String (W2K1) for the desired database connection.
Select the "Basic" authentication mode.
ENTER "Documents" for the document table.
ENTER "Docs" for the document access path.
ENTER "document_api.download" for the document access procedure.
Click the OK button at the top right of the screen.
For The Upload To Be Successful The Documents Table Must Be CREATED WITH THE FOLLOWING STRUCTURE.
CREATE TABLE documents (
name VARCHAR2(256) UNIQUE NOT NULL,
mime_type VARCHAR2(128),
doc_size NUMBER,
dad_charset VARCHAR2(128),
last_updated DATE,
content_type VARCHAR2(128),
blob_content BLOB
)
/
CREATE OR REPLACE PACKAGE document_api AS
PROCEDURE upload;
PROCEDURE upload (file IN VARCHAR2);
PROCEDURE download;
PROCEDURE download (file IN VARCHAR2);
END;
/
SHOW ERRORS
CREATE OR REPLACE PACKAGE BODY document_api AS
-- ----------------------------------------------------------------------------
PROCEDURE upload AS
-- ----------------------------------------------------------------------------
l_real_name VARCHAR2(1000);
BEGIN
HTP.htmlopen;
HTP.headopen;
HTP.title('Test Upload');
HTP.headclose;
HTP.bodyopen;
HTP.header(1, 'Test Upload');
HTP.print('<form enctype="multipart/form-data" action="document_api.upload" method="post">');
HTP.print(' File to upload: <input type="file" name="file"><br />');
HTP.print(' <input type="submit" value="Upload">');
HTP.print('</form>');
HTP.bodyclose;
HTP.htmlclose;
END upload;
-- ----------------------------------------------------------------------------
-- ----------------------------------------------------------------------------
PROCEDURE upload (file IN VARCHAR2) AS
-- ----------------------------------------------------------------------------
l_real_name VARCHAR2(1000);
BEGIN
HTP.htmlopen;
HTP.headopen;
HTP.title('File Uploaded');
HTP.headclose;
HTP.bodyopen;
HTP.header(1, 'Upload Status');
l_real_name := SUBSTR(file, INSTR(file, '/') + 1);
BEGIN
-- Delete any existing document to allow update.
DELETE FROM documents
WHERE name = l_real_name;
-- Update the prefixed name with the real file name.
UPDATE documents
SET name = l_real_name
WHERE name = file;
HTP.print('Uploaded ' || l_real_name || ' successfully.');
EXCEPTION
WHEN OTHERS THEN
HTP.print('Upload of ' || l_real_name || ' failed.');
HTP.print(SQLERRM);
END;
HTP.br;
-- Create some links to demonstrate URL downloads.
HTP.br;
HTP.print('URL Downloads:');
HTP.br;
FOR cur_rec IN (SELECT name FROM documents) LOOP
HTP.anchor('docs/' || cur_rec.name, 'docs/' || cur_rec.name);
HTP.br;
END LOOP;
-- Create some links to demonstrate direct downloads.
HTP.br;
HTP.print('Direct Downloads:');
HTP.br;
FOR cur_rec IN (SELECT name FROM documents) LOOP
HTP.anchor('document_api.download?file=' || cur_rec.name, 'document_api.download?file=' || cur_rec.name);
HTP.br;
END LOOP;
HTP.bodyclose;
HTP.htmlclose;
END upload;
-- ----------------------------------------------------------------------------
-- ----------------------------------------------------------------------------
PROCEDURE download IS
-- ----------------------------------------------------------------------------
l_filename VARCHAR2(255);
BEGIN
l_filename := SUBSTR(OWA_UTIL.get_cgi_env('PATH_INFO'), 2);
WPG_DOCLOAD.download_file(l_filename);
EXCEPTION
WHEN OTHERS THEN
HTP.htmlopen;
HTP.headopen;
HTP.title('File Downloaded');
HTP.headclose;
HTP.bodyopen;
HTP.header(1, 'Download Status');
HTP.print('Download of ' || l_filename || ' failed.');
HTP.print(SQLERRM);
HTP.bodyclose;
HTP.htmlclose;
END download;
-- ----------------------------------------------------------------------------
-- ----------------------------------------------------------------------------
PROCEDURE download (file IN VARCHAR2) AS
-- ----------------------------------------------------------------------------
l_blob_content documents.blob_content%TYPE;
l_mime_type documents.mime_type%TYPE;
BEGIN
SELECT blob_content,
mime_type
INTO l_blob_content,
l_mime_type
FROM documents
WHERE name = file;
OWA_UTIL.mime_header(l_mime_type, FALSE);
HTP.p('Content-Length: ' || DBMS_LOB.getlength(l_blob_content));
HTP.p('Content-Disposition: filename="' || file || '"');
OWA_UTIL.http_header_close;
WPG_DOCLOAD.download_file(l_blob_content);
EXCEPTION
WHEN OTHERS THEN
HTP.htmlopen;
HTP.headopen;
HTP.title('File Downloaded');
HTP.headclose;
HTP.bodyopen;
HTP.header(1, 'Download Status');
HTP.print(SQLERRM);
HTP.bodyclose;
HTP.htmlclose;
END download;
-- ----------------------------------------------------------------------------
END;
/
SHOW ERRORS
# format
http://<server-name>:<port>/pls/<DAD>/document_api.upload
http://myserver:7777/pls/UTILS/document_api.upload
The Second Overload of the Upload Procedure Does Not Really Upload The File AS THIS IS DONE Automatically by the dad. It Simply Allows You to Perform Additional Processing IF Necessary. Oracle Prefixes The File Name With A Generated Folder Name To Reduce The Posibility of Name Conflicts. In this Example The Files Are Renamed To Teir Original Names.
in Addition The Upload Code Products Two Types Of Links To Test The Download Code. The First Set of Links Use the "Document Access Path" and the "Document Access Path" Defined in the Dad. Theese Allow Access to The Files Using A Regular URL, Masking The Call Which Actually Returns The File. Using the Document Access Path in the URL Causes The Dad to Call The Document Access procedure. The Requested File Name Must Be Retrieved from The URL AND USED IN THE WPG_DOCLOAD.DOWNLOAD_FILE PROTECURE CALL.
The Second Set of Links Call An Alternative Download Procedure Directly. In This Case File Name Must Be Specified AS A Parameter.
For More Information See The Dad Documentation Loaded On Your Server. This is typically accessed using the Like the following url.
http://yourserver:7777/pls/simpledad/admin_/help/feature.htm#1004906
-
- Information
-
Who is online
Users browsing this forum: No registered users and 13 guests