Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

File Upload/Download in .doc format

439774Apr 3 2005 — edited Jan 17 2007
Hello everyone,

Need some immediate help regarding file upload-download.

I want to upload some documents to my application. These are in .doc/.rtf/.txt format.
But I want all these saved in .doc (MS Word) format before uploading.

File Browse item is not updateable, therefore, I created a hidden item in the same page to store the filename.

Using javascript I captured the value of the file browse item and put it in the hidden item, changed extension to .doc, updated wwv_flow_files with the new filename and tried to upload the file. This doesn't work, I get a 'No data found' error(see below code)

P11_CND_RESUME - File Browse Item
P11_wwv_name - Hidden Item in which file path and name stored as in P11_CND_RESUME
P11_FILENAME_1 - Filename with new extension

SAVE BUTTON PROCESS: (ON SUBMIT - AFTER COMPUTATION AND VALIDATION)

declare
L_LENGTH NUMBER(3);
L_POS NUMBER(3);
NEW_NAME_1_HALF VARCHAR2(1000);
NEW_NAME_2_HALF VARCHAR2(1000);
begin
:p11_wwv_name := :P11_CND_RESUME;

--if file name is f1059/document1.doc, extract the first half, ie., f1059/

select substr(:p11_wwv_name,1,instr(:p11_wwv_name,'/')) into new_name_1_half from dual;

--extract the second half of file name here ie., in example - document1.doc
select substr(:p11_wwv_name,instr(:p11_wwv_name,'/') + 1) into new_name_2_half from dual;

--get length of name
SELECT LENGTH(new_name_2_half) INTO L_LENGTH FROM DUAL;

--get position of file extension
SELECT INSTR(new_name_2_half,'.',-1,1) INTO L_POS FROM DUAL;

--extract only the file name without the extension
SELECT SUBSTR(new_name_2_half,1,L_LENGTH - (L_LENGTH - L_POS + 1)) INTO L_FILE_NAME FROM DUAL;

--concatenate extension .doc to file name
new_name_2_half := L_FILE_NAME || '.DOC';

--bring the filename to the format f1059/Document1.doc
:P11_FILENAME_1 := new_name_1_half || new_name_2_half;

--update wwv_flow_files with the new file name (.doc)
UPDATE wwv_flow_files
SET name = :P11_FILENAME_1,
filename = new_name_2_half
WHERE name = :P11_CND_RESUME;

insert this data into my table
INSERT INTO MY_TBL (id,name,mime_type,can_resume)
select ID, :P11_FILENAME_1,mime_type,blob_content
FROM WWV_FLOW_FILES WHERE NAME = :P11_FILENAME_1;

end;

The above code gives me a 'No data found' error.

How do I get to upload these documents? Is my approach wrong?
Pls let me know how this can be done.

Thanks,
Anu
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 14 2007
Added on Apr 3 2005
18 comments
1,788 views