WebUtil_file_transfer.client_to_db

Dear sir,
This is my code
Declare
Result BOOLEAN ;
Begin
Result:= Webutil_File_Transfer.Client_To_DB('c:\txt1.txt','photo','photo_image','ID=2') ;
if Result =true then
     message('gooooooooooooooood');
          message('gooooooooooooooood');
else
          message('Baaaaaaaaaaaaad');
          message('Baaaaaaaaaaaaad');
end if;
end;
my table name is photo
column name is photo_image BLOB
i put this code under bush button and i always get my defined message " baaaaaaaaaaad" .!!!
i tried to be in update state . i pushed excute_query where column id and its value 2 is found and pushed my button to store file but nothing !!
can any one help me ..
thnaks in dvance
Edited by: Eng Hossam Wally on 23/04/2011 05:48 ص

Dear Sir ,
This is the last java console txt ia have when i try and get the same defined message baaaaaaaaaaaad !! :D
" Oracle JInitiator: Version 1.3.1.22
Using JRE version 1.3.1.22-internal Java HotSpot(TM) Client VM
User home directory = C:\Documents and Settings\Hossam
Proxy Configuration: no proxy
JAR cache enabled
Location: C:\Documents and Settings\Hossam\Oracle Jar Cache
Maximum size: 50 MB
Compression level: 0
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
q: hide console
s: dump system properties
t: dump thread list
x: clear classloader cache
0-5: set trace level to <n>
Loading http://sicowin:8889/forms/java/frmall_jinit.jar from JAR cache
Loading http://sicowin:8889/forms/java/frmwebutil.jar from JAR cache
Loading http://sicowin:8889/forms/java/jacob.jar from JAR cache
Loading http://sicowin:8889/forms/java/GetImageFileName.jar from JAR cache
proxyHost=null
proxyPort=0
connectMode=HTTP, native.
إصدار بريمج Forms هو : 10.1.2.0
2011-أبر-23 21:21:32.625 ERROR>WUC-24 [URLDownload.pullFile()] حدث خطأ أثناء قراءة عنوان URL http://sicowin:8889/forms/webutil/jacob.dll
proxyHost=null
proxyPort=0
connectMode=HTTP, native.
إصدار بريمج Forms هو : 10.1.2.0
2011-أبر-23 21:25:27.984 ERROR>WUC-24 [URLDownload.pullFile()] حدث خطأ أثناء قراءة عنوان URL http://sicowin:8889/forms/webutil/jacob.dll
2011-أبر-23 21:25:30.734 ERROR>WUT-121 [WEBUTIL_FILE_TRANSFER.UploadInt] تم منع نقل الملف بواسطة المسئول
proxyHost=null
proxyPort=0
connectMode=HTTP, native.
إصدار بريمج Forms هو : 10.1.2.0
2011-أبر-23 21:26:25.250 ERROR>WUC-24 [URLDownload.pullFile()] حدث خطأ أثناء قراءة عنوان URL http://sicowin:8889/forms/webutil/jacob.dll
2011-أبر-23 21:26:27.593 ERROR>WUT-121 [WEBUTIL_FILE_TRANSFER.UploadInt] تم منع نقل الملف بواسطة المسئول
i will translate the non english words to you as :
حدث خطأ أثناء قراءة عنوان = An error occurred while reading the title
تم منع نقل الملف بواسطة المسئول = Was to prevent the transfer of the file by the official
Thanks in advance ..
Edited by: Eng Hossam Wally on 23/04/2011 12:33 م

Similar Messages

  • Webutil_file_transfer.client_to_db - insert 2 records

      INSERT INTO ORDMGMT.ib_loVE
                  (CONTRACT_NO, doc
           VALUES (:IB_LOVE.CONTRACT_NO, NULL
        lb$result := webutil_file_transfer.client_to_db (:b2.file_name, v_file_blob_name, v_col_blob_name, 'CONTRACT_NO = ' || :IB_LOVE.CONTRACT_NO);
              :SYSTEM.message_level := 25;
      COMMIT;
      :SYSTEM.message_level := 0;i run the code, and surprisingly, there are two records inserted, one with blob null, and one with blob not null, and both have the sam contract_no. How to solve this ? tx in advance

    Hi Red Penyon
    i run the code, and surprisingly, there are two records insertedPls check if u have any pre-insert block level , key-commit , pre-commitTrigger form-level or any Duplicate ; CREATE_RECORD ; Built-in may be u use to add this record.
    i Suggest if u remove the message Level from the commit other error messages may be pop up with a reason ...
    if not u can Remove the Commit as Anderas Suggested will the record be the one with blob or the one with blob not null value.
    or just for tracing purposes u can display a messages with the values of ur forms' items before and after the commit.
    MESSAGE (':b2.file_name ' || :b2.file_name);
    MESSAGE ('CONTRACT_NO = ' || :IB_LOVE.CONTRACT_NO); .... ETC.COMMIT;
    MESSAGE (':b2.file_name ' || :b2.file_name);
    MESSAGE ('CONTRACT_NO = ' || :IB_LOVE.CONTRACT_NO); .... ETC.Oracle® Forms Developer WebUtil User’s Guide Table 4–3 (Cont.) Available Functions in the WebUtil_File_Transfer Package doesn't mention anything regarding the insert process ..
    Regarding...
    both have the sam contract_noit should be unique.
    Hope this helps...
    Regards,
    Amatu Allah

  • Webutil_file_transfer.client_to_db leaves file locked

    I'm uploading a file to a BLOB column in the database using webutil_file_transfer.client_to_db. The problem is that the file is left locked in the filesystem.
    (OS=Win2000pro, RDBMS=9.0.2.1.0.)
    Is this a known bug, and/or is there a solution?
    Closing the browser releases the file.
    Regards,
    Ernst.

    We've had problems with webutil file reading/writting. Try putting two synchronize commands, one after the other before you upload.

  • WEBUTIL client_to_db file transfer

    I cannot delete a file from the local client drive after using the webutil_file_transfer.clinet_to_db function, whilst the form is still running
    -- CODE USED in Forms 9ir2
    DECLARE
         result BOOLEAN;
         wordexe VARCHAR2(1000);
    BEGIN
    delete_check;
    IF :ltr.datedl IS NOT NULL THEN
         lp_err_alert('Deleted letters may not be edited or opened.');
         RAISE FORM_TRIGGER_FAILURE;
    END IF;
         COMMIT_FORM;
         result := webutil_file_transfer.db_to_client('c:\temp\'||:ltr.letter_id||'.doc', 'REF_LETTER', 'OLE_BLOB', 'letter_id = '''||:ltr.letter_id||'''');
         write_header_file;
         wordexe := 'C:\Program Files\Microsoft Office\Office\';
         client_host(wordexe||'winword.exe c:\temp\'||:ltr.letter_id||'.doc', 0);
         result := webutil_file_transfer.client_to_db('c:\temp\'||:ltr.letter_id||'.doc', 'REF_LETTER', 'OLE_BLOB', 'letter_id = '''||:ltr.letter_id||'''');
         IF NOT result THEN
              lp_err_alert('Failed to write document');          
         END IF;
         COMMIT_FORM;
         result := webutil_file.delete_file('c:\temp\'||:ltr.letter_id||'.doc');     
         IF NOT result THEN
              lp_err_alert('Failed to delete document');
         END IF;
    EXCEPTION
    WHEN OTHERS THEN
         lp_err_alert('Failed');      
    END;
    What I find is that the webutil.delete_file fails. If you try and delete the file using explorer you get a file sharing violation.
    When the form is closed you can delete the file from explorer.
    If I comment out the client_to_db line the delete file works ok.
    Is the client_to_db leaving an object lock in the java functions?
    Anything I can do about this?

    Nigel,
    I don't know the bug number, but I remember that this is a known issue with the pre-release of webutil that is fixed in production. Unfortunately I don't know whether there exist a work-around or not.
    Frank

  • Webutil_file_transfer and webutil_db_local

    Hello
    I'm trying to use WEBUTIL_FILE_TRANSFER.CLIENT_TO_DB to upload a file into a blob column in the database.
    While debugging, in the function WEBUTIL_FILE_TRANSFER.UploadInt the following line of code exists:
    if not WebUtil_DB_Local.openblob(spec1, spec2, spec3,'W', m_maxTransferSize) then ...
    When I step into this function, this is what I see:
    PACKAGE BODY WEBUTIL_DB_LOCAL IS
    FUNCTION OpenBlob(blobTable in VARCHAR2,
    blobColumn in VARCHAR2,
    blobWhere in VARCHAR2,
    openMode in VARCHAR2,
    chunkSize in PLS_INTEGER default null) return BOOLEAN is
    BEGIN
    raise form_trigger_FAILURE; -- BY AN 30/6/2009, IT WAS WITHOUT THE "_local"
    return WebUtil_DB_local.OpenBlob(blobTable,
    blobColumn,
    blobWhere,
    openMode,
    chunkSize);
    END OpenBlob;
    Do I have something wrong with my installation or something?
    Thanks in advance for any help.

    That is exactly what Andreas is saying. Here is the code for the OpenBlob function in my WebUtil.pll.
      FUNCTION  OpenBlob(blobTable  in VARCHAR2,
                         blobColumn in VARCHAR2,
                         blobWhere  in VARCHAR2,
                         openMode   in VARCHAR2,
                         chunkSize  in PLS_INTEGER default null) return BOOLEAN is
      BEGIN
        return WebUtil_DB.OpenBlob(blobTable,
                                 blobColumn,
                                 blobWhere,
                                 openMode,
                                 chunkSize);
      END OpenBlob;                     This line: raise form_trigger_FAILURE; -- BY AN 30/6/2009, IT WAS WITHOUT THE "_local" should not be there.
    Craig...

  • How to delete file from client machine

    Hi all,
    we are using the DataBase: oracle:10g,
    and forms/reports 10g(developer suite 10g-10.1.2.2).
    can anybody help me how to delete the file from client machine in specified location using webutil or any
    (i tried with webutil_host & client_host but it is working for application server only)
    thank you.

    hi
    check this not tested.
    PROCEDURE OPEN_FILE (V_ID_DOC IN VARCHAR2)
    IS
    -- Open a stored document --
    LC$Cmd Varchar2(1280) ;
    LC$Nom Varchar2(1000) ;
    LC$Fic Varchar2(1280);
    LC$Path Varchar2(1280);
    LC$Sep Varchar2(1) ;
    LN$But Pls_Integer ;
    LB$Ok Boolean ;
    -- Current Process ID --
    ret WEBUTIL_HOST.PROCESS_ID ;
    V_FICHERO VARCHAR2(500);
    COMILLA VARCHAR2(4) := '''';
    BOTON NUMBER;
    MODO VARCHAR2(50);
    URL VARCHAR2(500);
    Begin
    V_FICHERO := V_ID_DOC;
    LC$Sep := '\';--WEBUTIL_FILE.Get_File_Separator ; -- 10g
    LC$Nom := V_FICHERO;--Substr( V_FICHERO, instr( V_FICHERO, LC$Sep, -1 ) + 1, 100 ) ;
    --LC$Path := CLIENT_WIN_API_ENVIRONMENT.Get_Temp_Directory ;
    LC$Path := 'C:';
    LC$Fic := LC$Path || LC$Sep || LC$Nom ;
    If Not webutil_file_transfer.DB_To_Client
    LC$Fic,
    'TABLE_NAME',
    'ITEM_NAME',
    'WHERE'
    ) Then
    Raise Form_trigger_Failure ;
    End if ;
    LC$Cmd := 'cmd /c start "" /MAX /WAIT "' || LC$Fic || '"' ;
    Ret := WEBUTIL_HOST.blocking( LC$Cmd ) ;
    LN$But := WEBUTIL_HOST.Get_return_Code( Ret ) ;
    If LN$But 0 Then
    Set_Alert_Property( 'ALER_STOP_1', TITLE, 'Host() command' ) ;
    Set_Alert_Property( 'ALER_STOP_1', ALERT_MESSAGE_TEXT, 'Host() command error : ' || To_Char( LN$But ) ) ;
    LN$But := Show_Alert( 'ALER_STOP_1' ) ;
    LB$Ok := WEBUTIL_FILE.DELETE_FILE( LC$Fic ) ;
    Raise Form_Trigger_Failure ;
    End if ;
    If Not webutil_file_transfer.Client_To_DB
    LC$Fic,
    'TABLE_NAME',
    'ITEM_NAME',
    'WHERE'
    ) Then
    NULL;
    Else
    Commit ;
    End if ;
    LB$Ok := WEBUTIL_FILE.DELETE_FILE( LC$Fic ) ;
    Exception
    When Form_Trigger_Failure Then
    Raise ;
    End ;sarah

  • Forms is not cooperating at all!!

    ok so idk maybe I'm just not intelligent enough to understand Forms but I have read through various Documentation on Forms 11g and done research on it and I have typed stuff exactly how I read about to put it and nothing seems to be working like it is supposed to.
    I am working on making a page that can upload and download a PDF from the client's computer to the Database and back by use of buttons. The upload page has a browse button that is supposed to bring up an open dialog box using webutil and then when the user selects a file the file path of that file will be placed into a text box so that 1. they can verify that it is correct and 2. to store the file path for later. Then the user clicks the upload button and the button is supposed to pull the file path from the text item and store the file located in that location into the database.
    here is the code for each of the buttons.
    browse button:
    DECLARE
         File_Path VARCHAR2(255);
    BEGIN
         FILE_PATH := WEBUTIL_FILE.FILE_OPEN_DIALOG
              C,
              null,
              '*.pdf'
         :block.file_upload_text := FILE_PATH;
         Synchronize;
         END;
    upload button:
    Declare
         Result_Upload BOOLEAN;
    Begin
         Result_Upload := Webutil_File_Transfer.Client_To_DB
              :block.file_upload_text,
              'file_tbl',
              'file'
    End;
    and the text box is in the data blocks drop down under buttons it was put there automatically by Forms. But when I try to compile it I get an Error 49 bad bind variable 'block.file_upload_text'
    the text item name is spelled correctly and everything I have found online says that is how to access the text in a text item I dont understand what is gong on that it isnt working and I am really getting annoyed at Forms because no matter how much I read about it and how much of the little of what is available that I look at I can not figure out what is wrong.
    Another problem I am having is that before you even get to this upload page there is another page and that page has a button that is supposed to pull up the upload page and I have figured out enough to figure out that I need the upload page canvas to be a data block in order to call it and then you use a go_block or something like that to pull it up but what I can't figure out is how to make that canvas into a data block... everything that I am finding is saying that to create a data block you need to call a table and stuff and I dont know how I am supposed to put that canvas into a table in the database so that I can create a data block with that canvas in it. I even found something that is supposed to walk you through how to do it and I got to like step 4 of 6 and it said to do something to do with double clicking the database node button or something and I looked everywhere and didn't find anything that said anything about database node. I have been working on this for about a month and a half now and it feels like I have gotten nowhere on it I still haven't even gotten to the download part at all.
    I got this same program working completely upload and download in Java in 2 weeks then found out we needed it to work with Forms so I found out I needed it to be a java bean not just java so I tried to figure that out, couldn't seem to figure out how a java bean worked with what I was trying to do and the only documentation I was able to find that might have been helpful for it was on a blog which are blocked from my work computer and I was informed that Forms had something built in that did exactly what I needed, well that hasn't helped much either so far... I could really use some detailed absolutely as dumbed down as possible help here because I really need to get this thing done.
    I know I rambled a little and I am sorry, any help that can be provided will be greatly appreciated!!

    Sorry for feeling uncomfortable with Forms. But your, I think there is a lot of room fpr (re-)reading forms documentation and other educational handouts.
    I won't solve yout problems, but may be I can give you few hints, tht came into my mind, when browsing yout post:
    DECLARE
    File_Path VARCHAR2(255);
    BEGIN
    FILE_PATH := WEBUTIL_FILE.FILE_OPEN_DIALOG( C, null, '*.pdf')
    +:block.file_upload_text := FILE_PATH;+
    Synchronize;
    END;
    1. What is C? You should get a compilation error since iot is nor declared.
    2. Do you need a directory ot a file. If the first take FILE_SELECTION_DIALOG into consideration. Or may ist easier for you to use CLIENT_GET_FILE_NAME. For this function don't miss to set FILE_SELECT-Parameter to FALSE.
    3. Are you sure the block, where the item FILE_UPDLOAD_TEXT is in is named BLOCK. Forms automatic naming will generate something like BLOCKn (where n is a number). But may be you have renamed the Block (what is common use).
    4. Declaration of file_path is not really necessary; you may assigne the result of the Function immediately to your forms item (via bind variable :<block_name>.<item_name>)
    5. Synchronize is not neccessary at this point, just costs a round-trip ofr the AS.
    (6. I'm an fan of PL/SQLs named parameter syntax; it make code easier to read and to maintaine. So your function call would read
    WEBUTIL_FILE.FILE_OPEN_DIALOG( directory_name => c, file_name => NULL, ...
    just a suggestion, fell free to uswr or not)
    The following is hard to understand. Probably you have a complete different understandind of how to program. You have to accept it's oracle forms an not sonething. That means there are certain structures:
    1. Data
    1 Form consits of one or several blocks; some of them may be connect to the database, often to a table, but it need not be a table; these are called database blocks, others (no database connect) are often called control block (but might also hold data).
    1 Block consists of one or several items; some of them hold data in form of text, numbers, date, image, lists, radios ...; others are means to control the application, e.g. buttons.
    2. View
    1 Form consists of one or several windows.
    1 Window contains one or more canvases; at least one content canvas; there are also other types, but I think you don't need them.
    On the the canvases you "paint" all the things you want to sho to your users, your items (you have to make an item visible and assigne a canvas in the canvas property), free text, graphic elements.
    You don't program a "page"! Your application is running within an applet within a page.
    3. Logic
    You may assigne logic via triggers to the elements of the data stack (form, block, item), not the view stack.
    You may put logic into procedures and functions for better readability and maintainance; these can be stored locally in the form or in own libraries for re-use in other forms.
    What trigger to use in which situation? That beyond my post.
    A special topic here: you can extend forms functionality with java beans. You have to extend forms functionalty with java beans, if you need to get our of the applet sand box. You need that because you want to read/write information of your local client. Basic Java beans you find in WEBUTIL. It offers, I am sure, all the functionality you need. And you have found them.
    So to get your problem solved of showing the whole stuff after pressing a button there a several possibilities:
    easiest: create 2nd content canvas and put your items there; at the switching button issue GO_BLOCK('<block_name>') OR GO_ITEM('<block_name>.<item_name>'), where block_name is that thing that makes the compilation trouble.
    bit mor an effort: create an own window with a new content canvas; the rest as described above; get some knowledge about SET_WINDOW_PROPERTY, espacially in cinjunction with the property VISIBLE, you will need it, whenn switching back;
    even more effort: create an new forms + .... and call this form on the swithing button.
    This might be a reasonable way if you want to re-use this function (up-/down-loading) from several forms.
    Last sentence, in java it took 2 weeks?in forms, Iwould say it's a task for 2-4 hours (forms and webutil correctly installed nd configured). But I won't tell your boss.

  • How to use Client_Host without the exe file path

    Hi,
    i'm using oracle forms 10g,
    in my application the users can upload any type of files (doc,xls,pdf,avi ,.. etc) and any user can download and open any of these files.
    i implement this using client_host and including the path of winword.exe or AcroRd32.exe ,...
    in many cases i don't know where these exe files are installed in the client side or whether it is installed or not.
    i tried this command : client_host('calc.exe') it works and show me the calc without including the path of this exe file.
    what i want to do is to just call the target file(doc,pdf,avi,..) in the client_host without having to precede this with the exe and path like the calc.exe example.
    if you go to start->run and write for example c:\ahmed.mpeg , windows automatically call the real player or any other video software installed and open the movie.
    can we implement this in oracle forms? and how?

    Hi, you attach a procedure to download a file in the local runs from Windows and to close it updates in the database and then delete the local directory
    PROCEDURE OPEN_FILE (V_ID_DOC IN VARCHAR2)
    IS
    -- Open a stored document --
    LC$Cmd Varchar2(1280) ;
    LC$Nom Varchar2(1000) ;
    LC$Fic Varchar2(1280);
    LC$Path Varchar2(1280);
    LC$Sep Varchar2(1) ;
    LN$But Pls_Integer ;
    LB$Ok Boolean ;
    -- Current Process ID --
    ret WEBUTIL_HOST.PROCESS_ID ;
         V_FICHERO VARCHAR2(500);
         COMILLA VARCHAR2(4) := '''';
         BOTON     NUMBER;
         MODO     VARCHAR2(50);
         URL     VARCHAR2(500);
    Begin
         V_FICHERO := V_ID_DOC;
              -- Ruta y nombre del fichero temporal --
              LC$Sep := '\';--WEBUTIL_FILE.Get_File_Separator ; -- 10g
              LC$Nom := V_FICHERO;--Substr( V_FICHERO, instr( V_FICHERO, LC$Sep, -1 ) + 1, 100 ) ;
              --LC$Path := CLIENT_WIN_API_ENVIRONMENT.Get_Temp_Directory ;
              LC$Path := 'C:';
              LC$Fic := LC$Path || LC$Sep || LC$Nom ;
              -- Descargamos el fichero --
              If Not webutil_file_transfer.DB_To_Client
              LC$Fic,
              'TABLE_NAME',
              'ITEM_NAME',
              'WHERE'
              ) Then
              Raise Form_trigger_Failure ;
              End if ;
              -- Abrimos el fichero temporal en local --
              LC$Cmd := 'cmd /c start "" /MAX /WAIT "' || LC$Fic || '"' ;
              Ret := WEBUTIL_HOST.blocking( LC$Cmd ) ;
              LN$But := WEBUTIL_HOST.Get_return_Code( Ret ) ;
              If LN$But <> 0 Then
                   Set_Alert_Property( 'ALER_STOP_1', TITLE, 'Host() command' ) ;
         Set_Alert_Property( 'ALER_STOP_1', ALERT_MESSAGE_TEXT, 'Host() command error : ' || To_Char( LN$But ) ) ;
         LN$But := Show_Alert( 'ALER_STOP_1' ) ;
         LB$Ok := WEBUTIL_FILE.DELETE_FILE( LC$Fic ) ;
         Raise Form_Trigger_Failure ;
              End if ;
              -- Actualizamos el fichero en la BBDD --
         If Not webutil_file_transfer.Client_To_DB
              LC$Fic,
              'TABLE_NAME',
              'ITEM_NAME',
              'WHERE'
              ) Then     
              NULL;     
              Else
                   Commit ;
              End if ;     
         -- Eliminamos el fichero temporal local --
              LB$Ok := WEBUTIL_FILE.DELETE_FILE( LC$Fic ) ;
    Exception
              When Form_Trigger_Failure Then
              Raise ;
    End ;

  • How to import data from CSV file into a table by using oracle forms

    Hi,
    I have a CSV file and i want to insert in oracle database in a table by using a button in oracle forms.
    the user can select CSV file by using open dialog .
    can any one help me to find method to make import and select file from the client machine ?
    thx.

    1. create table blob
    CREATE TABLE IB_LOVE
      DOC          BLOB,
      CONTRACT_NO  VARCHAR2(20 BYTE)                NOT NULL
    )2. use the code below to insert:
           INSERT INTO ordmgmt.ib_love
                       (contract_no, doc
                VALUES (:control.contract_no_input, NULL
           lb$result :=
             webutil_file_transfer.client_to_db (:b2.file_name, v_file_blob_name, v_col_blob_name,
                                                 'CONTRACT_NO = ' || :control.contract_no_input);
           :SYSTEM.message_level := 25;
           COMMIT;
           :SYSTEM.message_level := 0;3. use the code below to download
         if :control.CONTRACT_NO_INPUT is not null then
              vboolean :=   webutil_file_transfer.DB_To_Client_With_Progress(
                               vfilename,  --filename                       
                              'IB_LOVE', ---table of Blob item                       
                              'DOC',  --Blob column name                       
                              'CONTRACT_NO = ' || :CONTROL.CONTRACT_NO_INPUT, ---where clause to retrieve the record                       
                              'Downloading from Database', --Progress Bar title                       
                              'Wait to Complete'); --Progress bar subtitle  client_host('cmd /c start '||vfilename);
              client_host('cmd /c start '||vfilename);                 
         else
              errmsg('Please choose contract no');
         end if;4. use the code below to open file dialog
    x:= WEBUTIL_FILE.FILE_OPEN_DIALOG ( 'c:\', '*.gif', '|*.gif|*.gif|', 'My Open Window' ) ;
    :b2.FILE_NAME:=X;

  • How do I make the webutil file transfer works correctly?

    Hello,
    I'm using Oracle 10g Database and form builder in developer suite 10g release 2. Running on Windows XP SP2.
    I've created a database user, executed the create_webutil_db.sql , and created a table as below:
    CREATE TABLE DOCS
    (DOC_ID VARCHAR2(15) NOT NULL,
    DOC_IMAGE BLOB,
    TEXT_DESCRIPTION CLOB,
    FILENAME VARCHAR2(80),
    FILE_SIZE NUMBER NOT NULL,
    CONSTRAINT PK_DOCS PRIMARY KEY (DOC_ID)
    I've created two buttons in the from, one for upload and one for download
    the upload code:
    DECLARE
         fname VARCHAR2(1000);
         fext VARCHAR2(1000);
         result BOOLEAN;
    BEGIN
         fname := Client_Get_File_Name(null,null,null,null,OPEN_FILE,TRUE);
         fext := fname;
         WHILE instr(fext,'.') <> 0 LOOP
              fext := substr(fext,instr(fext,'.')+1);
         END LOOP;
         IF LOWER(fext) <> 'doc' THEN
              message('Only Microsoft Word Document (*.doc) can be uploaded');
         ELSE
              result := Webutil_File_Transfer.Client_To_DB
              (trim(fname),'DOCS','DOC_IMAGE','DOC_ID = ' || '''' || :DOC_ID || '''');
              IF result THEN
                   message ('Upload success');
                   :FILENAME := fname;
                   :FILE_SIZE := WebUtil_file.file_size(:FILENAME);
                   WHILE instr(:FILENAME,'\') <> 0 LOOP
                        :FILENAME := substr(:FILENAME,instr(:FILENAME,'\')+1);
                   END LOOP;
              ELSE
                   message ('Upload failed');
              END IF;
         END IF;
    END;
    and the download code:
    DECLARE
         result BOOLEAN ;
    BEGIN
         IF :FILE_SIZE > 0 THEN
              result := Webutil_File_Transfer.DB_To_Client
         (trim(Client_Get_File_Name(null,:FILENAME,null,null,SAVE_FILE,TRUE)),'DOCS','DOC_IMAGE','DOC_ID = ' || '''' || :DOC_ID || '''');
              IF result THEN
                   message ('Download success');
              ELSE
                   message ('Download failed');
              END IF;
         ELSE
              message('No file to download');
         END IF;     
    END;
    I can upload the file to the database, and download the file.
    However, the file being downloaded is corrupted. I don't know why this will happen. I've tried to rebuild the form, re-attach the webutil library, rebuild the database users and tables, but all these doesn't work.
    Please help, thank you.
    Message was edited by:
    se072c23

    1 Can u try running the sample form available from OTN (WU_TEST) and check whether it works
    2 If it doesnt then enable the java console and check the error message
    Rajesh ALex

  • Webutil upload is holding the file that it uploads

    Hi am creating n application using a lot of webutil commands to upload files that were scanned onto the users machine. I am having the following problem - after a call the webutil upload I try to call the webutil delete file to delete the file that was jsut uploaded off of the users machine. the problem is that once the file gets uploaded it does not get released until I am all the way out of internet exploerer - not only out of the application but totally out of internet exploerer.
    I am going to attach part of the code and notice that I need to be able to delete the file from the users machine after it is uploaded.(in the same session)
    v_random_number := random_number(6);
    INSERT INTO NEEDS_TO_BE_MOVED (RANDOM_NUMBER,APPLICATION_NAME,USER_MACHINE_NAME,DOC_NAME,
                        DOC_MOD_DATE_TIME,USER_ID,DOC_TYPE,DOC_PAGE_COUNT)VALUES
                        ( V_RANDOM_NUMBER,V_APPLICATION_NAME,V_COMPUTER_NAME,V_ACTUAL_DOC_NAME,
                        SYSDATE,USER,NULL,NULL);
    UPLOAD_BLOB_TO_DB(V_DOC_NAME,'RANDOM_NUMBER = '||V_RANDOM_NUMBER);
    COMMIT;
    v_boolean_delete_file:=WEBUTIL_FILE.DELETE_FIL(v_doc_name);
    --this is the code for the UPLOAD_BLOB_TO_DB proc
    PROCEDURE UPLOAD_BLOB_TO_DB(P_FILE IN VARCHAR2,P_WHERE IN VARCHAR2) IS
    l_success boolean;
    BEGIN
    l_success := webutil_file_transfer.Client_To_DB
    (clientFile => P_FILE
    ,tableName => 'NEEDS_TO_BE_MOVED'
    ,columnName => 'DOCUMENT'
    ,whereClause => P_WHERE
    ,asynchronous =>false
    ,callbackTrigger => null
    if l_success
    then
    SET_ALERT('File uploaded successfully into the Database');
    else
    SET_ALERT('File upload to Database failed');
    end if;
    exception
         when others
         then
         SET_ALERT('File upload failed: '||sqlerrm);
    END;
              

    can someone please respond to this issue that I having.
    I need to get thsi working ASAP!!!

  • Read_image_file in web mode

    hello,
    when i'm using the read_image_file in web mode, i've got the ORA 99 999 error message.
    but it works in client/server.
    my image is a gif format in the same path as the form.
    i use a unix ware 7 server with OAS.
    when i execute the form directly on the server, it works fine.
    can anyone help me ?
    thanks.
    null

    Hello ,
    Actually i have faciing the problem when i m upload the selected document in database,
    i have write down the code(IN button) GIVEN BELOW:-
    when i have press tha button i got the error
    ERROR:- WUT-121 - THE FILE HAS BEEN FORBIDDEN BY THE ADMINISTRATOR.
    PLEASE GIVE ME THE SUGGESTION.ASAP
    MAIL ME ON [email protected] solutions.
    DECLARE
         OPEN_FILE BOOLEAN;
    BEGIN
    OPEN_FILE:=WEBUTIL_FILE_TRANSFER.CLIENT_TO_DB
         ('C:\TEMP\BRC.XLS',
         'DOCUMENT',
         'DOC',
         FALSE,
         NULL
    END;
    THX

  • WEBUTIL (attach and view files from database) --- Vista vs. XP differences

    I have attached the following code. We are using Oracle Application Server 10.1.2.3 patch
    My questions are provided following the code.
    -- Open the local temporary file --
    -- v_COMMAND := 'cmd /c start "" /WAIT "' || v_FULL_FILENAME || '" /w';
    v_COMMAND := 'cmd /c start "" /WAIT "' || v_FULL_FILENAME || '"';
    v_PROCESS_ID := WEBUTIL_HOST.blocking( v_COMMAND );
    v_TEMP := WEBUTIL_HOST.GET_RETURN_CODE( v_PROCESS_ID );
    If v_TEMP <> 0 Then
    r_ERR_MSG := 'Host command error(' || To_Char( v_TEMP ) || ')';
    v_FLAG := WEBUTIL_FILE.DELETE_FILE( v_FULL_FILENAME ) ;
    RAISE PANIC;
    End if ;
    if p_FILE_ACCESS = 'W' then
    -- Re-store the modified file in the database --
    If Not Webutil_File_Transfer.Client_To_DB ( v_FULL_FILENAME, 'mis_mst.FT_SUP_FILES', 'FILE_DATA',
    'FILE_NBR = ' || To_Char( p_FILE_NBR ) ) Then
    r_ERR_MSG := 'Error on storing file';
    Raise PANIC;
    Else
    Clear_Message;
    -- show_message('File re-stored in the database') ;
    End if;
    else
    Clear_Message;
    -- show_message('NOTE: "' || v_FILENAME || '" was not updated in the database' );
    end if;
    -- Remove the temporary local file --
    v_FLAG := WEBUTIL_FILE.DELETE_FILE( v_FULL_FILENAME ) ;
    If v_FLAG = FALSE Then
    Bell ;
    -- show_message( 'Error removing "' || v_FULL_FILENAME || '" from the PC.' );
    End if ;
    For the most part, we are able to open files in both XP and Vista. We are having a couple of problems with certain file types; specifically, (JPG and ZIP).
    We have a workaround, but I would like to know why the problem occurs.
    When the user opens a JPG from our application using the Windows Vista client (JPG are associated with Windows Media Player by default), the system will not open the file. The system states that the file doesn't exist. What I think is happening is that Windows Media Player takes awhile to load and before WMP is fully loaded, the file is deleted (the /WAIT command must not fully wait for the command to complete, causing Forms to continue with its code to delete the file). When WMP tries to open the file, the file has already been deleted from the operating system. I have tried the "/WAIT <filename>" and the "/WAIT <filename> /w" parameters.
    The workaround is to reassociate the file with MS Paint or Microsoft Office Viewer (instead of Windows Media Player).
    Are any of you aware of issues (or differences) in the wait command between Windows XP and Windows Vista?

    Thank you, Thank you, Thank you!!!!
    I believe that will work (adding a sequence number to the end of the filename)!
    We do not allow a user to update the file, only view. If a user wants to make a change, they need to remove the existing file (from the database), create a new file (outside of our application), and attach the file in our application (into the database). All updates occur outside of our application - we are not a document authoring system, just a document storage system.
    Once again, many thanks on the solution!
    Mike

  • To upload and download

    i hv 2 buttons one for upload and another for download
    through webutil
    i hv written this code but it is not inserting record into the table, thr r no records in the table, it is empty, when i try to upload .txt file it is showing me an error "missing expression" ORA-00936
    the code is
    declare
    sMY_file varchar2(200);
    v_Last_Directory      Varchar2(2000);
    v_Upload_Succes     boolean;
    nWHERE          number(10);
    OUT_DOC_ID number;
    temp_id number;
    doc_id_temp number;
    v_status VARCHAR2(200);
    BEGIN
    OUT_DOC_ID:=:parameter.p_dealid; --:files.deal_id;
         sMY_file := WebUtil_File.File_save_Dialog(v_Last_Directory,
         'test',
         '|All Files|*.*|',
         'Select a file');
    if OUT_DOC_ID is not null then
    v_Upload_Succes := WebUtil_File_Transfer.Client_to_db(sMY_file,
    'deal_document_file', -- TABLE name
    'CONTENT' , -- columname
    'deal_id||='||OUT_DOC_ID ||' and document_file_name='||:files.document_file_name -- where          
    elsif OUT_DOC_ID is null then
         v_status := get_block_property('files',status);
    temp_id:=get_id;
    :files.deal_id:=temp_id;
    :files.document_file_name:= substr(sMY_file,instr(sMY_file,'\',-1)+1);
         insert into deal_document_file (deal_id,document_file_name) values
    (:files.deal_id, :files.document_file_name);
         commit;
         v_Upload_Succes := WebUtil_File_Transfer.Client_to_db(     sMY_file,
    'deal_document_file', -- TABLE name
         'CONTENT' , -- columname
         'deal_id='||:files.deal_id||' and document_file_name='||:files.document_file_name
    end if;     
    commit;
    if (v_Upload_Succes) then
         :files.maker:= sysuser;
         :files.made_at:=sysdate;
    end if;
    end;
    commit;
    could anybody help me in this.

    No, the form is not fine else you would not have this FRM error message.
    Check the syntax of the parameters given to the WebUtil_File_Transfer.Client_to_db() Webutil function. add a message() instruction just after to see if the function if well executed.
    Francois

  • Some JPG images, stored in DB, do not display on screen/image item.

    Hi friends,
    I have a form to save and retrieve images (JPG, GIF, TIF) to and from DB, using WEBUTIL_FILE_TRANSFER.CLIENT_TO_DB and CLIENT_IMAGE.WRITE_IMAGE_FILE respectively.
    It’s working fine, but with few JPG images, it stores in DB but do not display on screen/image item.
    Secondly, if I try to retrieve and write this JPG to OS (using CLIENT_IMAGE.WRITE_IMAGE_FILE), it prompts error “FRM-47101: Cannot write image file”.
    Environment:
    Forms [32 Bit] Version 10.1.2.0.2
    OS XP Pro 2002 SP3
    Oracle DB 11g Enterprise Edition Rel. 11.1.0.7.0 - 64bit
    Any help will be highly appreciated.

    Hi,
    I have done a workaround here, which worked for me.
    My requirement is to direct save images in DB. So my system was just saving images without knowing if picture would display on form or not later.
    I created a (non-DB) image item on form and added a code (CLIENT_IMAGE.READ_IMAGE_FILE) to place image in this image item, if it successfully display image then save image directly in DB using code (WEBUTIL_FILE_TRANSFER.CLIENT_TO_DB).
    Note: - If CLIENT_IMAGE.READ_IMAGE_FILE fails it raises exception and it means image has invalid format/internal data header and system does not save image in DB.
    Now I have a kind of a filter to stop saving pictures which do not display later on form. :)
    Edited by: user12173428 on 29/09/2011 16:38

Maybe you are looking for

  • Won't let me download purchased songs (error 8517), Won't let me download purchased songs (error 8517)

    There's about 25 or so songs that I have purchased but can't download. Whenever I click on Downloads, It says there are 25 songs available for download, I click to download them and they all come up with an error. Someone suggested I go to Store -->

  • Help with importing subtitles in FCP!

    Hello I need HEEELP, please) I'm trying to import XML but an error show up: time code: Required element <frame> not found for time code definition( line 11 ) and the titles are always in the center of the screen no matter what changes I did before. I

  • Burning the same DVD in NTSC and PAL

    Hi, I need to burn two DVDs, one in NTSC and one in PAL. When I started the process of burning in NTSC, it took about an hour to "Process Movie" After that, I changed the setting in iDVD Preferences to PAL, and started to burn another DVD. This time

  • Back to Tape?

    Is there a way to take a sequence from Final Cut Pro and record it back onto a dv tape? Bones

  • EXPORT Problem. when i choose USER mode, it is exporting full database

    Dear OTN Members, we have a system ORacle 8i, 8.1.3 database, we created a user with DBA role, when we want to export data for a perticular user, after giving USER MODE Option, it is doing full database export including sys, system etc. what is the r