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

Similar Messages

  • 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 AM

    Thank 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

  • How to get the mime type of the workflow attachment attached to workitem id

    Hi Experts,
    I can attach different types of attachment to the workitem id, lets suppost the attachment type attached is pdf, for this attachment I have an requirement to send the mime type as well. In this case the mime type is 'application/pdf' for pdf files.(for text file it is 'text/plain' and for zip file it is 'application/zip' and so on)
    Do I have any place in ABAP world where I can get the mime type for different types of attachments.
    I dont want to hard code the mime types, and I have checked the transaction 'SMW0', but not sure if this is the correct place to get the mime type.
    Do you see any other way or tables which stores all these mime types.
    Any help/suggestion would be appreciated.
    Thanks and Regards,
    Neerup.

    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

  • 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
    Harbinder

    hi
    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 get the 'mime-type' of a Resource accessed via WebDAV

    Hello,
    When a document is uploaded into a folder which is managed by a WebDAV RepositoryManager we don't see a Property 'mime-type' or something like that.
    Our code:
    <i>IPropertyMap lijstProp = tempResource.getProperties();</i>
    In the list there is no Property 'contenttype' or something like that!
    This is a bit of a surprise to me since it seems to me a very relevant Property of a Resource.
    How can the mime-type/contenttype of a Resource managed by a WebDAV Repository Manager be determined?
    Kind regards,
    Maarten Rutten

    Hi Thilo,
    We access the Resources via API.
    When I use "IPropertyMap lijstProp = tempResource.getProperties();" I assume that ALL the available properties are in 'lijstProp'.
    (is this correct?)
    I don't have the Property "contenttype" available in 'lijstProp'.
    A workaround could be that when adding documents to a folder via API's, we also should set this Property via API's.
    But when documents are added directly into the WebDAV folder we don't have that option. So, when we find a Resource with the Property 'contenttype' missing the only option I see is to 'calculate' the contenttyype based on the extension of the Resource.
    Do you agree?
    Kind regards,
    Maarten

  • The MIME type for xslx file is different in Mozilla 13.0.1

    The MIME type for a xslx file is coming as "application/vnd.ms-excel.12" in Mozilla 13.0.1 instead of the "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" which comes in other browsers when using fileUpload.PostedFile.ContentType

    Firefox usually gets the MIME type from the MIME database registry key.
    * HKEY_CLASSES_ROOT\.xslx
    * HKEY_CLASSES_ROOT\MIME\Database\Content Type

  • How get Mime Types of File/image

    I would like to get the MIME type all image/files inside a
    folder

    http://techfeed.net/blog/index.cfm/2007/3/16/Discover-MIME-type-in-ColdFusion
    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/

  • Identifying the correct MIME type for file uploads

    How does Apex identify the MIME type of an uploaded file? I have a page that uploads a file and accesses it via APEX_APPLICATION_FILES. That works fine. The problem is that, for certain file types, the mime_types column is "application/octet-stream" instead of the correct file type. I think it's using the Content-Type from the client browser, though I'm not quite sure. Is there any way to override this server-side in Apex?
    I'm running Apex with mod_plsql. Adding an AddType directive to Apache and adding the correct association to the mime.types file did not work.

    Hi,
    I also noticed this - it seems that Microsoft's 4 char extensions like .docx are not being recognized by application type so that either the web server or mod-plsql is defaulting to the "application/octet-stream" mime type which refers to a file with binary content - instead of the traditional "application/msword" mime type you would expect.
    If you know, at the point of insert into your database table, both the mime type and file name, one workaround would be to check if the mime type is 'application/octet-stream' and the file's extension is ".docx" or other likely extensions and then treat it as mime type 'application/msword", etc.
    Not really a solution but might be sufficient workaround depending on your situation.
    Ted
    Edited by: Ted Martin on Oct 25, 2012 7:27 PM

  • How to get the URI of a file in a WAR

    Hi all,
    I have a deployed WAR.
    One of its files need to get the URI of another file in this war.
    In exploded format, application.getRealPath(thefilename) would do the
    trick. But it failed if the application is deployed in WAR archive.
    What's the workaround ?
    Note that I need the full path of the file since I need to read its
    content and parse it as XML using DOMParser that requires the full URI ..
    Any help appreciated ..
    mona

    I have a piece of code that does this that looks like this:
    InputStream inStream =
    <ServletClassName>.class.getResourceAsStream("/foo.xml");
    InputStreamReader inReader = new InputStreamReader(inStream);
    And 'foo.xml' is put in the classpath either by placing it in a .jar file in
    the WEB-INF/lib directory or by placing it in a .jar file that is deployed
    with the webapp .war file in an .ear file and then referenced by the
    'Class-Path:' manifest directive in the META-INF/MANIFEST.MF file of the
    webapp.war file. Both ways work. I would think you could put 'foo.xml' in the
    WEB-INF/classes directory and that work work, too. But, I haven't tried that.
    Bill
    Mona Ramlawi wrote:
    Hi all,
    I have a deployed WAR.
    One of its files need to get the URI of another file in this war.
    In exploded format, application.getRealPath(thefilename) would do the
    trick. But it failed if the application is deployed in WAR archive.
    What's the workaround ?
    Note that I need the full path of the file since I need to read its
    content and parse it as XML using DOMParser that requires the full URI ..
    Any help appreciated ..
    mona

  • I have tried to view videos created in premiere elements 10 and I get the following message: "this file type is not supported, or the required codec is  not installed.  When it opens there is a red screen in the monitor panel with Korean writing which als

    I have tried to view videos created in premiere elements 10 and I get the following message: "this file type is not supported, or the required codec is  not installed.  When it opens there is a red screen in the monitor panel with Korean writing which also appears in the place of each clip in the video.  I tried uninstalling and reinstalling premiere elements 10, but that did not have any effect on the video.  Do you have any suggestions?  I researched codec, but do not understand them at all.

    gloucester
    In case you did not find it, the following is a copy/paste of the Announcement on Premiere Elements 19/NVIDIA GeForce
    that appears at the top of this forum.
    Premiere Elements 10 NVIDIA Video Card Driver Roll Back
    If you are a Premiere Elements 10 user whose Windows computer uses a NVIDIA GeForce video card and you are experiencing
    Premiere Elements 10 display and/or unexplained program behavior, then your first line of troubleshooting needs to be rolling
    back the video card driver version instead of assuring that it is up to date.
    Since October 2013 to the present, there have been a growing number of reports about display and unexplained workflow
    glitches specific to the Premiere Elements 10 user whose Windows computer has a NVIDIA GeForce video card. If this applies
    to you, then the “user to user” remedy is to roll back the NVIDIA GeForce video card driver as far as is necessary to get rid of
    the problems. The typical driver roll back has gone back as far as March – July 2013 in order to get a working Premiere
    Elements 10. Neither NVIDIA nor Adobe has taken any corrective action in this regard to date, and none is expected moving forward.
    Since October 2013, the following thread has tried to keep up with the Premiere Elements 10 NVIDIA reports
    http://forums.adobe.com/thread/1317675
    Older NVIDIA GeForce drivers can be found
    http://www.nvidia.com/Download/Find.aspx?lang=en-us
    A February 2014 overview of the situation as well as how to use the older NVIDIA GeForce drivers for the driver roll back can be found
    http://atr935.blogspot.com/2014/02/pe10-nvidia-video-card-roll-back.html
    ATR

  • 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

  • Need to get the Mail attachment name as it is to the receiver file adapter

    I am doing a Mail to File scenario. I need to get the attachment from the mail and store it on the file server. I am using the PayloadSwap bean in the sender mail adapter. My requirement is to carry forward the attachement name as it is to the receiver file adapter side and store the file with the same name.
    Did any one try doing this? I was looking at developing an adapter module but got struck as I could not find whether the attachement name is stored in the XI payload after it has got swapped using the swap bean.
    Any help would be appreciated.
    VJ

    Oops pressed the send key. Take two.
    This is becoming a damn nightmare. When I run the adapter I am getting ModuleExceptions. Can you pass your eyes over these Java config settings to see what I am doing wrong. Using NWDS CE 7.1 with PI 7.1 both at SP07. All the imports were taken from PI 7.1 after SP07 was applied. The build id of NWDS is
    SAP NetWeaver Developer Studio
    SAP NetWeaver 7.1 Composition Environment SP07 PAT0001
    Build id: 200901152336
    APPLICATION.XML
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN"
    "http://java.sun.com/dtd/application_1_3.dtd">
    <application>
    <display-name>MailPOP_EAR</display-name>
    <description>EAR description</description>
    <module>
    <ejb>MailPOP_EJB.jar</ejb>
    </module>
    </application>
    APPLICATION-J2EE-ENGINE.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE application-j2ee-engine SYSTEM "application-j2ee-engine.dtd">
    <application-j2ee-engine>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="service">engine.security.facade</reference-target>
    </reference>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="library">engine.j2ee14.facade</reference-target>
    </reference>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="service">com.sap.aii.af.svc.facade</reference-target>
    </reference>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="interface">com.sap.aii.af.ifc.facade</reference-target>
    </reference>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="library">com.sap.aii.af.lib.facade</reference-target>
    </reference>
    <reference reference-type="hard">
    <reference-target provider-name="sap.com" target-type="library">com.sap.base.technology.facade</reference-target>
    </reference>
    <fail-over-enable mode="disable" />
    </application-j2ee-engine>
    EJB-J2EE-ENGINE.XML
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-j2ee-engine SYSTEM "ejb-j2ee-engine.dtd">
    <ejb-j2ee-engine>
    <enterprise-beans>
    <enterprise-bean>
    <ejb-name>GetMailAttachment</ejb-name>
    <jndi-name>GetMailAttachment</jndi-name>
    <session-props/>
    </enterprise-bean>
    </enterprise-beans>
    </ejb-j2ee-engine>
    EJB-JAR.XML
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans
    2.0//EN"
    "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar>
    <description>EJB JAR description</description>
    <display-name>EJB JAR</display-name>
    <enterprise-beans>
    <session>
    <ejb-name>GetMailAttachment</ejb-name>
    <home>com.sap.aii.af.lib.mp.module.ModuleHome</home>
    <remote>com.sap.aii.af.lib.mp.module.ModuleRemote</remote>
    <local-home>com.sap.aii.af.lib.mp.module.ModuleLocalHome</local-home>
    <local>com.sap.aii.af.lib.mp.module.ModuleLocal</local>
    <ejb-class>sample.GetMailAttachment</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    SENDER MAIL ADAPTER modules
    1 AF_Modules/PayloadSwapBean Local EB 1
    2 GetMailAttachment Local EB 2
    3 sap.com/com.sap.aii.adapter.mail.app/XIMailAdapterBean Local EB 3
    1     swap.keyName          payload-name
    1     swap.keyValue          MailAttachment-1
    RECEIVER FILE MODULES
    1     localejbs/AF_Modules/DynamicConfigurationBean     Local Enterprise Bean     1
    2     localejbs/CallSapAdapter                    Local Enterprise Bean     2
    1     key.0          write http://sap.com/xi/XI/System/File FileName
    1     value.0          message.interface
    VARIABLE FILENAME SUBST WITH ASMA TURNED ON
    fName     message:interface_name
    JAVA SOURCE
    package sample;
    import javax.ejb.CreateException;
    import javax.ejb.SessionBean;
    import javax.ejb.SessionContext;
    import com.sap.aii.af.lib.mp.module.Module;
    import com.sap.aii.af.lib.mp.module.ModuleContext;
    import com.sap.aii.af.lib.mp.module.ModuleData;
    import com.sap.aii.af.lib.mp.module.ModuleException;
    import com.sap.engine.interfaces.messaging.api.Message;
    import com.sap.engine.interfaces.messaging.api.MessagePropertyKey;
    import com.sap.engine.interfaces.messaging.api.TextPayload;
    import com.sap.engine.interfaces.messaging.api.XMLPayload;
    import com.sap.aii.af.service.cpa.Channel;
    @ejbHome <{com.sap.aii.af.lib.mp.module.ModuleHome}>
    @ejbLocal <{com.sap.aii.af.lib.mp.module.ModuleLocal}>
    @ejbLocalHome <{com.sap.aii.af.lib.mp.module.ModuleLocalHome}>
    @ejbRemote <{com.sap.aii.af.lib.mp.module.ModuleRemote}>
    @stateless
    <code>GetMailAttachment</code>
    @SuppressWarnings("unused")
    public class GetMailAttachment implements SessionBean, Module {
         private static final long serialVersionUID = 7612238514043673502L;
         private SessionContext myContext;
         private MessagePropertyKey myFileName;
         public void ejbRemove() {
         public void ejbActivate() {
         public void ejbPassivate() {
         public void setSessionContext(SessionContext context) {
              myContext = context;
    @throws CreateException
         public void ejbCreate() throws CreateException {
         public void getMessageProperty(MessagePropertyKey FileName) {
              myFileName = FileName;
    @param moduleContext
               Contains data of the module processor that might be important
               for the module implementation such as current channel ID
    @param inputModuleData
               Contains the input XI message as principal data plus eventual
               set supplemental data
    @return ModuleData Contains the (changed) output XI message. Might be the
            response message if the module is the last in the chain.
    @exception ModuleException
                   Describes the cause of the exception and indicates whether
                   an retry is sensible or not.
         @SuppressWarnings("deprecation")
         public ModuleData process(ModuleContext moduleContext,
                   ModuleData inputModuleData) throws ModuleException {
              try {
                   Message msg = (Message) inputModuleData.getPrincipalData();
                   TextPayload payload = msg.getDocument();
                   String contentType = payload.getContentType();
                   // Content Type could be something like
                   // text/plain;charset="UTF-8";name="file.txt"
                   contentType = contentType.replaceAll("\"", "");
                   int i = contentType.lastIndexOf("=") + 1;
                   String fileName = contentType.substring(i);
                   msg.setMessageProperty(myFileName, fileName);
                   inputModuleData.setPrincipalData(msg);
              } catch (Exception e) {
              return inputModuleData;
    JAVA ERRORS
    2009-02-04 11:41:14     Information     Mail: calling the module processor for channel LMK_Common_Mail_Sender
    2009-02-04 11:41:14     Information     Swap: swapping by payload-name ? MailAttachment-1
    2009-02-04 11:41:14     Information     Swap: successfully swapped
    2009-02-04 11:41:14     Information     Mail: message leaving the adapter (call)
    2009-02-04 11:41:14     Information     The application tries to send an XI message asynchronously using connection AFW.
    2009-02-04 11:41:14     Information     Backward validation is enabled
    2009-02-04 11:41:14     Error     Unable to validate the message with message ID 8702df71-f254-11dd-9b9b-001a64a73518
    2009-02-04 11:41:14     Error     Returning to application. Exception: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Content is not allowed in prolog.
    2009-02-04 11:41:14     Error     Mail: error occured: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Content is not allowed in prolog.
    2009-02-04 11:41:14     Error     Mail: error occured: com.sap.aii.af.lib.mp.module.ModuleException

  • Anyone figured out a way to use JWS without needing the MIME type preloaded

    Anyone figured out a way to use JWS without needing the MIME type preloaded on the client's computer?
    Why is it not server-side loading? How can I force a load of JWS and the MIME-type?

    when you install web start, the mime type jnlp is associated with WEBstart.
    The WEB start home page has code to request an
    install if web start is not on the user system.
    On the web server, of course you need to specify the association between a
    .jnlp file and the mime type. This is in the configuration of the server.
    It would be nice if standard ISP's provided that for user directories.
    Anyone think AOL would do this?
    After all it should not cost anything like installing servlets.

  • I am trying to make a pdf of a file and I need to get the file size to be no bigger than 10MB. What is the best way to do this

    I am trying to make a pdf of a file and I need to get the file size to be no bigger than 10MB. Even when I save it, the image quality at minimum the file size is 10.9 MB. What is the best way to do this

    @Barbara – What purpose is that PDF for? Print? Web?
    If web purpose, you could convert CMYK images to sRGB. That would reduce the file size as well.
    A final resort to bring down file size is:
    1. Print to PostScript
    2. Distill to PDF
    That would bring file size down even more. About 20%, depending on the images and other contents you are using, compared with the Acrobat Pro method. If you like you could send me a personal message, so we could exchange mail addresses. I could test for you. Just provide the highres PDF without any downsampling and transparency intact. Best provide a PDF/X-4.
    I will place the PDF in InDesign, print to PostScript, distill to PDF.
    Uwe

  • What do I need to get the 6.7 update [to read the CR2 canon raw files] installed in Photoshop elements 10 [new computer with Windows 8]?

    I downloaded the zip file for the 6.7 update and unzipped it. I double clicked on the .exe file and it would not install. What do I need to get the update installed?

    Is this the 6.7 camera raw updater you tried?
    It's specifically for pse 10 on windows.
    Adobe - Photoshop Elements : For Windows : Camera Raw 6.7 update for Elements 10
    What camera do you have?

Maybe you are looking for

  • Sharing files with other members of my family on the wireless network

    I would like to share my files with other members of my family on the wireless network. Unfortunately, their pcs are MS Windows OS and connected in workgroup type while I am on Mac. I can access internet via the same wireless router but cannot see ot

  • How to download internal table data to excel in WebUI

    Hi everyone, I am trying to download the contents of an internal table to excel in CRM Web UI. One way, would be to create a table view and use the export to excel button. However, wish to avoid this and directly download using code. Also tried conve

  • Enabling QoS for enterprise on a router

    Hello, I plan to enable QOS for enterprise on a customer's router between three (3) to five (5) days. Will this have an impact on the router for the said days? Thanks you in advance, Martin.

  • Add items in VL01N

    Hi experts , I m creating a delivery through VL01N. When I have put tcode VL01N it open the screen with header and item details of order. Now my requirement is that if I delete any line item and then again add it then it should populate a error messa

  • Feature Request: Reopen PDF at last open page

    1........................... At work, I often have to deal with PDF files (of several hundred pages each) and have to keep shifting from one PDF to another. If I leave a PDF file on page 372, open another file, and return to the first file, I am sent