Dbms_lob mime type
Hello everybody.
Im working with Oracle Database 10g R 1 on Linux RedHat.
My problem: Im uploading pics to my database with the DBMS_LOB PACKAGE, all work good, except that I need to know the mime type of pic.
Can anyone point me to any document where I can learn how to do this?
Thanks in advanced and regards to all.
You shold have a look here:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:950029833940
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
-------------------------------------------------------------------
Similar Messages
-
Need to get the MIME type of Files
hi
I have a table which contains Partno and the images name i.e PRODUCT_AWG_20070416 and the data would be like that :-
partno img_name
PX1 px1.jpeg
PX2 px2.jpeg
PX3 px3.jpeg
Now one by one i am Inserting those files into my table (img_temp -BLOB Column) which are exists in directory & the map file. but i also need to insert the MIME type of the inserted file. can you please provide me the way to generate MIME type on the basis of file type like (JPG,GIF,TXT etc).
the procedure i am using is as follows :
hi
I have a TABLE which contains Partno AND THE IMAGES NAME i.e PRODUCT_AWG_20070416 AND THE DATA would be LIKE that :-
partno img_name
PX1 px1.jpeg
PX2 px2.jpeg
PX3 px3.jpeg
Now one BY one i am INSERTING those files INTO my TABLE (img_temp -BLOB COLUMN) which are EXISTS IN DIRECTORY & THE map FILE. but i also need TO INSERT THE MIME TYPE OF THE inserted FILE. can you please provide me THE way TO generate MIME TYPE ON THE basis OF FILE TYPE LIKE (JPG,GIF,TXT etc).
the reason of this requirement is, we need to use that table in APEX 2.2 fromwhere i can download the inserted file and to download the file we need to get correct MIME_TYPE of that file.
Please Suggest me the way.
Thanks.
The Procedure which i am using is as follows :
CREATE OR REPLACE PROCEDURE img_uploader IS
CURSOR Cur_img IS SELECT part_no,image_file FROM PRODUCT_AWG_20070416
WHERE Transaction_id =1 ;
l_bfile BFILE;
l_blob BLOB;
BEGIN
FOR Cur_img_val IN Cur_img LOOP
l_bfile := BFILENAME('SOLVS_PRODUCT_IMG', Cur_img_val.image_file);
INSERT INTO img_temp (part_no,MIME_type,file_name, img)
VALUES (Cur_img_val.Part_no,NULL, Cur_img_val.image_file,EMPTY_BLOB())
RETURN img INTO l_blob;
DBMS_LOB.fileopen(l_bfile, Dbms_Lob.File_Readonly);
DBMS_LOB.loadfromfile(l_blob, l_bfile, DBMS_LOB.getlength(l_bfile));
DBMS_LOB.fileclose(l_bfile);
END LOOP ;
COMMIT;
END;Hello,
Perhaps this can help:
http://help.sap.com/saphelp_nw04/helpdata/en/ad/ebe5cc1d75aa43a2871717d76f475d/content.htm
If you want to know the table name, turn on tracing (ST05) when accessing the MIME types.
regards
Rick Bakker
Hanabi Technology -
MIME type issue in version 4.1/4.2 Compatibility Mode
Problem: when displaying a PDF file, it displays OK as PDF if APEX 'Compatability Mode' = 'Pre 4.1', but displays as HTML when in either '4.1' or '4.2' mode.
Apex: 4.2.2.00.11
DB: 11gr2
Web server: Apache on Linux
More detailed description... this seems to be a MIME type issue related to APEX (or maybe DB) versioning. The following code works as expected when run in 'Pre 4.1' mode - ie. it displays an appropriate PDF document in the appropriate Acrobat/other plugin in several browsers (Firefox/Opera/Chrome/IE). But just by changing 'Compatability Mode' to '4.2' (or even '4.1'), it then downloads the file but displays it as a bunch of random characters, and the web page header MIME type is 'text/HTML'.
Note: this also happens with other file types such as xls/doc/etc, but I expect fixing PDF should also fix these.
I'm at a bit of a loss as to where this is happening, it seems there is a difference in the 'Compatibility Modes' between either the creating of the HTML header using 'OWA_UTIL.mime_header' or the component path it traverses before reaching apache.
The only other thing I could think of is that we do a bit of redirection to display the PDF, though this seems like it might be a red herring. Basically we use page 560 as a container, and then display the PDF with page 561 within a frame embeded within page 560. So, on the page 560, which is the one we reference throughout the application, we have a region with a source of '<iframe src=?p=&APP_ID.:561:&SESSION.height="500" width="700"></iframe></pre>'. Then on page 561, in a 'On Load - Before Header' process, we make the call to the code 'DOWNLOAD_APPLICANT_PDF' (below).
Note: I did try calling 'apex_application.stop_apex_engine' after 'DOWNLOAD_APPLICANT_PDF', as suggested in a couple threads, but it didn't fix the problem, and caused a couple low-level system errors.
Code:
<pre>
CREATE OR REPLACE PROCEDURE DOWNLOAD_APPLICANT_PDF ( p_doc_id IN NUMBER
AS
v_length NUMBER;
lob_loc BLOB;
l_display_inline CHAR := '1';
BEGIN
SELECT pdf_data, DBMS_LOB.getlength (pdf_data)
INTO lob_loc, v_length
FROM pdf_dest
WHERE pdf_dest_id = p_doc_id;
OWA_UTIL.mime_header ('application/pdf', FALSE);
HTP.p ('Content-length: ' || v_length);
HTP.p ('Content-Disposition:inline;filename="mydoc.pdf"');
OWA_UTIL.http_header_close;
WPG_DOCLOAD.download_file (lob_loc);
END;
</pre>Hi,
for some background information about the above changed behavior, have a look at 4.2 Before Header Processes and Browser Security HTTP Headers of the APEX 4.1. release notes.
Regards
Patrick
Member of the APEX development team
My Blog: http://www.inside-oracle-apex.com
APEX Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf -
Uploading files Mime Type not correct for Office 2007 default extensions.
hi all,
My company has recently moved over to MS Office 2007 and the default extensions for word, excel etc are now .docx, xlsx etc (ie xml based).
Unfortunately now when we upload files through APEX to the database the MIME TYPE value for these files isn't being recognised and not loadeding correctly into the APEX_APPLICATION_FILES table and subsequently any future retrieval of these files fails.
I could put some logic inthe up load procedure to look at the filename in APEX_APPLICATION_FILES and hard code in the releavnt mime types but this still causes problems when retrieving the content.
Has anyone come across this and got a workround? Is it a bug in AE?
regards
James
FYI - using APEX 3.0.2 over 11G.I have not any response to my question and not sure if it is in Apex I need to look or the tomcat server that I need to look. I have a useful application to try to show others what Apex can do for our customers to collaborate. However, most of our customers are using office 2007 so, hoping this is possible.
I am using apex 3.2.0.00.27 if that helps someone to point me where to find more info on being able to have Word 2007 or excel 2007 fire up to open a .docx or .xlss file stored in a table blob column. Word or Excel does fire up to open .doc and .xls files.
The following is the query for a report selecting the filenames uploaded into a blob column in my table:
{ SELECT s.ID, SUBSTR(s.NAME,INSTR(s.NAME, '/',1,1)+1,length(s.NAME)) SHORT_FNAME, s.SUBJECT
FROM spp_attachments s
WHERE s.PROGRAM_ID = :P2_PROGRAMID }
Below is the stored procedure called from the link on the short_fname column in report query above.
{ create or replace PROCEDURE download_file(p_file IN number) AS
v_mime VARCHAR2(48);
v_length NUMBER;
v_file_name VARCHAR2(2000);
Lob_loc BLOB;
BEGIN
APEX_APPLICATION.G_FLOW_ID :=245;
IF NOT (wwv_flow_custom_auth_std.is_session_valid) then
owa_util.status_line(404, 'Page Not Found',true);
return;
else
SELECT MIME_TYPE, BLOB_CONTENT, name,DBMS_LOB.GETLENGTH(blob_content)
INTO v_mime,lob_loc,v_file_name,v_length
FROM spp_attachments
WHERE id = p_file;
-- set up HTTP header
-- use an NVL around the mime type and
-- if it is a null set it to application/octect
-- application/octect may launch a download window from windows
owa_util.mime_header( nvl(v_mime,'application/octet'),
FALSE );
-- set the size so the browser knows how much to download
htp.p('Content-length: ' || v_length);
-- the filename will be used by the browser if the users does a save as
htp.p('Content-Disposition: attachment;
filename="'||replace(REPLACE(substr(v_file_name,instr(v_file_name,'/')+1),chr(10),NULL),chr(13),NULL)|| '"');
-- close the headers
owa_util.http_header_close;
-- download the BLOB
wpg_docload.download_file( Lob_loc );
end if;
end download_file; }
Thank you,
Mark -
How can I use one Add-on prior to another for specific MIME-types?
I'm using Shockwave Flash plugin to watch some videos on YouTube, StreamCloud, etc. It also handles .mkv and .mp4 files/streams. After installing VLC Web plugin to handle MIME-types like mp3/4, mkv additionally and prior to the Flash plugin, Firefox keeps using Flash to handle those types insted. I cannot find options to set the desired priorities. Only disabling the Flash plugin solves my problem, but also keeps me from watching Flash contents, which Is not acceptable.
Did I miss something or is this Firefox's fault?If you type or paste '''about:plugins''' in the address bar and press Enter, you can see which plugins are associated which various content types.
I do not know how to prioritize one over the other for the same content type if the plugin settings (plugins often have an interface outside of Firefox to adjust their settings) do not allow that.
As for MP4, I don't think Flash normally would be selected. I suspect the website is specifying a Flash media player and streaming the MP4 through that. If you want to hide the Flash plugin from a particular website, you can use the Permissions tab of the Page Info dialog.
Click the padlock or globe icon in the address bar, then More Information, then Permissions. The top section of the Permissions panel should be "Activate Plugins". Here you can select Block for Flash for the current site. After reloading the page, does the media play using a different plugin? -
Unable to launch application from my machine:Bad MIME Type
Hi,
The following error message was printed when I tried to access the SwingSet2 demo from the Java Web Start site.
An error occurred while launching/running the application.
Title: SwingSet2
Vendor: Sun Microsystems, Inc.
Category: Download Error
Bad MIME type returned from server when accessing resource: http://java.sun.com/products/javawebstart/apps/SwingSet2.jnlp - text/html
Can you please suggest what is to be done to rectufy this problem?
Regards,
SatishBad MIME type returned from server when accessing
resource:
http://java.sun.com/products/javawebstart/apps/SwingSet
.jnlp - text/htmlit should return application/x-java-jnlp-file.
My guess is that you use proxy which messes up headers.
Otherwise try to reinstall Web Start, then enable the console and log output in Web Start's advanced preferences to get more clues what's going on.
Regards,
Marc -
How to change default application associated with some mime types?
When we install some new program, for example GIMP, I assume the newly installed program is added to some mime type database, and the /usr/share/applications/mimeinfo.cache file is automatically generated.
Using my example, GIMP will be the default application for all its registered mime types, even application/pdf. I surely don't want this to happen, and I surely don't want to create all kinds of files that GIMP registered and right click on them and choose Properties and then change it in the Open with... tab. I want to systematically de-prioritize GIMP so that it will not override my previously assigned default applications.
I wrote a script to modify the mimeinfo.cache file, and it seems to work great. However, after a reboot or upgrade or something I didn't notice, the default application of application/pdf is reconfigured to GIMP. I think the cache suffix of the file indicates that it is just a cache and may be changed by system unnoticed. So I am looking for a new way to change the default applications.
As far as I know or guess from the phenomena, there should be some system utility that generates the mimeinfo.cache file, it seems to parse all the *.desktop files under /usr/share/applications and register them to certain mime types accordingly. The sequence of the *.desktop files get parsed seems to be related to the time the application is installed, and the newly installed applications seems to be parsed later and inserted in the front of the application list or be parsed earlier and appended to the application list. Is there some place I can change the sequence of the parsing? Or is there some place I can change the behavior of the system utility?
I know that I can populate my ~/.local/share/applications/mimeapps.list to override the system wide defaults, however, I want a more elegant way to this.
Any opinion on this is welcomed.
Last edited by AugustePop (2010-05-14 05:47:15)Ah, right. Don't know what DE you are on, but in Gnome: right-click a (e.g. pdf) file -> Preferences -> Open with.
All Applications listed there will be available from the right click menu, the marked one will be used on double-click.
errgrh...
I surely don't want to create all kinds of files that GIMP registered and right click on them and choose Properties and then change it in the Open with... tab. I want to systematically de-prioritize GIMP so that it will not override my previously assigned default applications.
I guess what I am trying to propose is this: "de-prioritize" GIMP in its .dekstop file for the types you dont want it to be associated with, and manually add it back in through "Open With" for the file types you want it to be an option. Not sure if this is solving anything for you though
Last edited by hokasch (2010-05-14 10:28:57) -
File/Open Dialog Box / Setting MIME type
In my application, I am calling a web service that returns text that I need to download into an EDI application. I am simply looking to have an open/file dialog box open when the text is returned. I was using the following code in a PL/SQL process:
begin
-- Set the MIME type
owa_util.mime_header( 'application/octet', FALSE );
-- Set the name of the file
htp.p('Content-Disposition: attachment; filename="EDIOuput.edi"');
-- Close the HTTP Header
owa_util.http_header_close;
end;
The problem is the HTML code that comes along with the text that is returned. Is there a way to simple call the procedure on a page that only containes the raw data?
Thank you.HTML doesn't provide you the possibility to select multiple files or select folders at a single browse. Thus JSF can't do any much for you. Best what you can do is to write a signed applet or web start application which does the task. The Mojarra Scales component library has a ready-to-use component which embeds an applet which does that task. Check [https://scales.dev.java.net/multiFileUpload.html].
-
Print HTML using JPS API.. How to configure printer MIME-TYPE as text/html
Hi All,
I have to print the HTML pages.. for this i have used JPS API , but i found that my printer doesnt supoort Mime-type(Flavour) text/html.
Can someone help me in this ...
i) Can i configure my printer for this Mime-type , if yes then HOW?
ii) Is there any work around ?
Thank you all in advance :)I reposted this question in the Database forum. Admin can feel free to delete this thread.
The answer is to add this at the top: htp.addDefaultHTMLHdr(false);
Thanks,
T.
Edited by: 855677 on May 3, 2011 9:35 AM -
How To Get FileType and MIME Type from a File
Hi,
I am using following ways to get FileType and MIME Type.
I am able to get file type, but I am getting MIME Type as */*
Can any one please let me know how to get MIME Type, but it should not be time consuming process.
For File Type I am using following Code:
private String getFileData(InputStream inStream) {
fileName = C:\temp\temp.tiff
String filePath = Util.createTempFile(fileName);
RandomAccessFile raf = new RandomAccessFile(filePath, "rw");
while (inStream.available() > 0) {
byte[] buf = new byte[inStream.available()];
inStream.read(buf);
raf.write(buf);
inStream.close();
raf.close();
File file = new File(filePath);
JFileChooser chooser = new JFileChooser();
String fileType = chooser.getTypeDescription(file);
file.delete();
//MIME Type I am getting from
DataHandler data = new DataHandler(new DocumentSource(inStream));
data.getContentType();
data.getContentType() is not working well in all cases.
Can any one help me on this.
Thanks in advance,
Ram.
Edited by: javausers07 on Apr 15, 2009 4:25 PMjavausers07 wrote:
Hi,
I am using following ways to get FileType and MIME Type.
I am able to get file type, but I am getting MIME Type as */*
Can any one please let me know how to get MIME Type, but it should not be time consuming process.
For File Type I am using following Code:
private String getFileData(InputStream inStream) {
fileName = C:\temp\temp.tiff
String filePath = Util.createTempFile(fileName);
RandomAccessFile raf = new RandomAccessFile(filePath, "rw");
while (inStream.available() > 0) {
byte[] buf = new byte[inStream.available()];
inStream.read(buf);
raf.write(buf);
inStream.close();
raf.close();
File file = new File(filePath);Why do you do all above?
JFileChooser chooser = new JFileChooser();
String fileType = chooser.getTypeDescription(file);
file.delete();
//MIME Type I am getting from
DataHandler data = new DataHandler(new DocumentSource(inStream));
data.getContentType();
data.getContentType() is not working well in all cases.That's because there's no way to get MIME type of all files on all filesystems.
Kaj -
How to restrict uploading files by mime type?
Hi,
I have been searching the forum (and Google) looking for tips on how to ensure users can only upload files of specific formats (Word, PDF, etc) for specific document types as defined within the application (e.g. Curriculum Vitae (Word), Copy of Transcripts (PDF)).
While I have used this research to start work on a server-side solution, I would like to know if there is an apex-friendly way to "validate" a file-browse item based on mime-type.
Has anyone else had to address this?
TedHi,
I would like to know if there is an apex-friendly way to "validate" a file-browse item based on mime-typeHow about, you create a check constraint on your MIMETYPE column. something similar to this:
alter table "MY_TABLE" add constraint
"MY_TABLE_CON" check ( "MIMETYPE" = 'application/pdf' or "MIMETYPE" = ......)Or you can use this plugin, provided using browsers supporting HTML 5:
http://www.theapexfreelancer.com/apex/f?p=APEXFREELANCER:FILE_UPLOAD:0
For friendly,
Please check error handling :
http://www.inside-oracle-apex.com/apex-4-1-error-handling-improvements-part-1/
Best Regards,
Fateh -
How to get the Mime Type of the file?
Hi Everyone!,
I want to upload a random file into my table as a BLOB and simultaneously want to fill the respective another column with its MimeType. Earlier I used Oracle Apex for this, but due to my new requirement I need to make this happen with the help of PL SQL and Forms. Could you help me in getting how we can upload the file and most importantly, how we can get its Mime-Type.
My chosen file can be of any type; it can be doc ,pdf,txt,xls ,gif or any other format.
If you could provide the example with your reply then it would be great.
Thanks
Harbinderhi
for that u have to use webutil.
declare
f varchar2(100);
begin
f := webutil_file.file_open_dialog();
if f is not null then
:doc.doc_name := f;
end if;
end;and
DECLARE
filename VARCHAR2(256);
BEGIN
filename := CLIENT_GET_FILE_NAME (File_Filter => 'jpg (*.jpg)|*.*|');
READ_IMAGE_FILE(filename, 'jpg', 'image');
END; sarah -
How to determine the MIME types of the files?
I'm making an application, in which I've to upload the files to the database. Now I want to insert into the database the MIME type of the files. Now how can I know that which type of the file is having which MIME type?
where can I get the list of all supported MIME types?
Even if I get the list, then every time I update the file in the database, so every time I have to check the file extension and then insert the MIME type...
this seems to be a tedioius job..
Is there any simple way to do this?I could ask "supported by what?" but I assume you will
be the one supporting them. Here's a link to the
latest list of registered MIME types.HERE's the link...
ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/media-types -
How to get the MIME type of the given file in R/3
Dear Experts,
Please tell me the FM or Class to get the given file MIME type in R/3 . I am using GUI_upload Function module to upload the file in R/3 .
Edited by: balaji ramadas on Jan 16, 2009 5:39 AMThank you Prosenjit I m using this FM CV120_GET_MIME_TYPE
to get the MIME type of the file
regards,
Balaji.R
Edited by: balaji ramadas on Jan 19, 2009 9:24 AM -
I am trying to invoke the SharePoint Rest Api using HTML page. I have included the Access Control Allow Origin to the web.config file. I am getting Readty State 4 and
Status Success but still I am getting the below error.
Refused to execute script from 'http://<server>/_api//web/lists?callback=jQuery172045857910416089_1430217181282&_=1430217363882' because its MIME
type ('application/atom+xml') is not executable, and strict MIME type checking is enabled.
<script>
$(document).ready(function () {
$("#KMPDiscussions").click(function () {
//$.support.cors = true;
$.ajax({
url: "http://<server>/_api//web/lists",
dataType: "jsonp",
type: "GET",
method: "GET",
contentType: "application/javascript",
headers: {
"content-type":
"application/json;odata=verbose",
"accept": "application/json;odata=verbose",
success: function onSuccess(data) {
alert("Inside Alert");
error: function onError(data){
alert("Error: "
+ data);
</script>
It always hits the error on callback.
Is there any other way that I can invoke SharePoint Rest Api from a Cross Domain. Please Help.Hi Chris,
Thanks for the reply,Here iam using different files to be uploaded in library.
please find the below snapshot of json response and ULS logs.
12/22/2013 18:31:15.02 w3wp.exe (0x3338) 0x401C SharePoint Foundation Files
abq2i High Could not get DocumentContent row: 0x80004005. 79f7629c-4694-c026-
3349-2049178ee919
12/22/2013 18:31:15.02 w3wp.exe (0x3338) 0x401C SharePoint Foundation Files
aiv4w Medium Spent 0 ms to bind -1 byte file stream 79f7629c-4694-c026-3349-
2049178ee919
12/22/2013 18:31:15.02 w3wp.exe (0x3338) 0x401C SharePoint Foundation Files
aise3 Medium Failure when fetching document. 0x80070012 79f7629c-4694-c026-
3349-2049178ee919
12/22/2013 18:31:15.39 w3wp.exe (0x3338) 0x0D4C SharePoint Foundation
Database ab1a9 High Failed to get document content data.
System.ComponentModel.Win32Exception (0x80004005): Cannot complete this function at
Microsoft.SharePoint.SPSqlClient.GetDocumentContentRow(Int32 rowOrd, Object
ospFileStmMgr, SPDocumentBindRequest& dbreq, SPDocumentBindResults& dbres)
79f7629c-76ab-c026-3349-2c9132b13e9a
12/22/2013 18:31:15.39 w3wp.exe (0x3338) 0x4184 SharePoint Foundation
Database ab1a9 High Failed to get document content data.
System.ComponentModel.Win32Exception (0x80004005): Cannot complete this function at
Microsoft.SharePoint.SPSqlClient.GetDocumentContentRow(Int32 rowOrd, Object
ospFileStmMgr, SPDocumentBindRequest& dbreq, SPDocumentBindResults& dbres)
79f7629c-76ab-c026-3349-281167b6cd09
Thanks again,
Naresh.
Maybe you are looking for
-
How to deploy a .war file in jboss using eclipse
Hi, iam new to using eclipse as my ide. i have installed the jboss ide in it. i have a servlet and i would like to deploy the servlet in jboss through eclipse, can some one help me with this
-
HP Pavilion DV6 - problem with HP recovery - error 1005
I'm trying to format the computer and reinstall windows. The laptop does not have a hard disk partition for the recovery. I'm using the DVD's that where made when I got the computer. I can open the HP recovery system and get about 36% in, before i ge
-
ORA-12505 on Oracle Database 10g Express Edition: TNS:listener
In Developer3, trying to connect to Oracle Database 10g Express Edition give me: Listener refused the connection with the following error: ORA-12505 TNS:listener does not currently know of SID given in connect descriptor Vendor code 12505 Edited by:
-
I can't download, update or install anything from the MAS
I recently paid for Mountain Lion from the MAS, but I click download and nothing happens. I left it for five hours, and still the download hasn't even started, or attempted to start. No Error messages have come up. So, I tried downloading a small fre
-
Printing- What am I Missing?
Can Anyone PLEASE help me. I just cannot get a decent print from within Lightroom. I have a Dell Digital Monitor that excels the 'required' for digital retouching. I Callibrate it with a Eye one Display 2. I own a HP pro B9180. I have the correct cou