Apex file upload

Oracle Application Express - web application development tool (antigamente conhecido como Oracle HTML-DB)
Post Reply
rafaelchagas.sp
Rank: Programador Júnior
Rank: Programador Júnior
Posts: 17
Joined: Tue, 13 Oct 2009 4:52 pm
Location: Sorocaba - SP

I would like to upload a file to my server through the item "Search file" ..
can anyone give me an idea of ??how to do this?
How do I refer in my code, the path of the selected item file?

Hugs
victorhugomuniz
Moderador
Moderador
Posts: 1396
Joined: Fri, 01 Feb 2008 2:06 pm
Location: Rio de Janeiro - RJ
Contact:
:D

gokden
Rank: DBA Pleno
Rank: DBA Pleno
Posts: 264
Joined: Sun, 19 Aug 2007 8:18 pm
Location: Ribeirão Preto - SP
Lucas de Souza

OCA Developer
Analista de sistemas

the way that speaks the tutorial above, it shows how to upload to a field blob ....

I and my boss do not like the idea of ??tacar everything in a blob file, então agent made a routine to save this in a physical file in the bank (bfile) and save the blob as null, so it does not get filling the database and increasing the size of my backup, already chi agent abuses too much Sending file to the bank. And without speaking it gets easier to manage the physical files than to manage BLOB.
The Fiocu routine thus:

Select all

PROCEDURE PKB_UPLOAD_FILE (eb_lob  in blob, 
                           pfname  in varchar2, 
                           pdir    in varchar2 default 'ANEXO_S') is 
 
vtamanho  integer; 
vfile     utl_file.file_type; 
vamount   binary_integer := 32767; 
vposicao  integer := 1; 
vbuffer   raw(32767); 
varquivo  varchar2(30); 
vn_fase   varchar2(100); 
-- 
 
BEGIN 
-- 
  vtamanho := dbms_lob.getlength(eb_lob); 
-- 
  vn_fase := 1||'. '||pdir||' - '||pfname; 
-- 
  vfile := utl_file.fopen( pdir, 
                           pfname, 
                           'wb', 
                           32767 ); 
-- 
  vn_fase := 2; 
-- 
  while vposicao < vtamanho 
  loop 
-- 
    if vposicao + vamount > vtamanho then 
      vamount := (vtamanho + 1) - vposicao; 
    end if; 
-- 
  vn_fase := 3; 
-- 
    dbms_lob.read(eb_lob, vamount, vposicao, vbuffer); 
-- 
  vn_fase := 4; 
-- 
    utl_file.put_raw(vfile, vbuffer, true); 
-- 
  vn_fase := 5; 
-- 
    utl_file.fflush(vfile); 
-- 
  vn_fase := 6; 
-- 
    vposicao := vposicao + vamount; 
-- 
  end loop; 
-- 
  utl_file.fclose(vfile); 
-- 
 
EXCEPTION 
   when others then 
        raise_application_error (-20001, vn_fase||' Erro na PKB_UPLOAD_FILE : ' || sqlerrm); 
-- 
 
END PKB_UPLOAD_FILE;
dennys.rafael
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 3
Joined: Mon, 13 Nov 2017 10:28 am

Hi Lucas.
Using this procedure You can implement this process in Apex?.
That is, the user can upload the file and this file go to a directory on the server and then the user perform the download via apex?
dennys.rafael
Rank: Estagiário Pleno
Rank: Estagiário Pleno
Posts: 3
Joined: Mon, 13 Nov 2017 10:28 am

I'm testing the procedure and is giving this error:
Error 29280 Invalid directory path.
Does anyone know how to solve?
Post Reply
  • Information
  • Who is online

    Users browsing this forum: No registered users and 9 guests