Newbie: check binary type of file

hi all
Is there simplest way to check target file is text file or binary type?
(I googled for a while but still not hit it :(
Thanks and regards,

Any file is a sequence of bytes. Your interpretation of whether those bytes taken as a whole are "text" versus "binary" is up to you.

Similar Messages

  • How to check the type of uploaded file

    Hi, experts,
    how can I check the type of the uploaded file? I am dealing with exception handling now: when user uploads a type of file which is not allowed, then error msg shows up. So first I have to retrieve the type of the uploaded file.
    Best regards,
    Fan

    Best approach would be to control the file upload program. Here in force user to chose only the kind of file supported.
    If you are using WD4A & fileupload UI element, then after user select a file to upload, before processing the file you can check the file name and get its MIME TYPE as shown below.
    example
    data type file string.
    data dot_offset type i.
    data extension type mimetypes-extension.
    data mimetype type mimetypes-type.
    file = 'Image.jpg'.
    " Find out file name extension
    find first occurrence of regex '\.[^\.]+$' in file match offset dot_offset.
    add 1 to dot_offset.
    extension = file+dot_offset.
    " Get mime type
    call function 'SDOK_MIMETYPE_GET'
      exporting
        extension = extension
    importing
        mimetype  = mimetype.
    later using if/else or CASE statement define your logic.
    Greetings
    Prashant
    P.S. Points Welcome

  • I mistakenly saved a download, and checked the "always do this for thid type of file" now I cannot open a file without saving it first, because it does not take me to that same dialog box.

    When you open a file from an email, you get a dialog box Open or Save this file. I wanted to save a particular file, so I clicked Save. The problem is, I had already clicked on "do this every time for files like this" so now it won't give me the dialog box back for when I just want to open a file, not save it. I have searched Options, to no avail.

    '''''"always do this for thid type of file"''''' means exactly what it says: '''<u>always</u>''' .
    Go to Tools > Options > Applications, locate and click on the Content Type for the item, change Action to "Always ask". This will cause a dialog to open giving you a choice of opening with an appropriate plugin for Firefox or saving the item to your hard drive. See:
    *http://support.mozilla.com/en-US/kb/Managing+file+types
    *http://kb.mozillazine.org/File_types_and_download_actions
    '''Other issues needing your attention'''
    The information submitted with your question indicates that you have out of date plugins with known security and stability issues that should be updated. To see the plugins submitted with your question, click "More system details..." to the right of your original question post. You can also see your plugins from the Firefox menu, Tools > Add-ons > Plugins.<br />
    <br />
    *Adobe PDF Plug-In For Firefox and Netscape "9.4.1"
    **'''''Security update version 9.4.2 released on 2011-02-08'''''
    **Info on version 10 (Reader X)"
    ***New Adobe Reader X (version 10) with Protected Mode was released 2010-11-19
    ***See: http://www.securityweek.com/adobe-releases-acrobat-reader-x-protected-mode
    *Shockwave Flash 10.1 r102
    **'''''Security update version 10.2.152.26 released on 2011-02-08'''''
    *Next Generation Java Plug-in 1.6.0_23 for Mozilla browsers
    **'''''Security update version 1.6.0_24 released on 2011-02-10'''''
    #'''Check your plugin versions''': http://www.mozilla.com/en-US/plugincheck/
    #*'''Note: plugin check page does not have information on all plugin versions'''
    #'''Update Adobe Reader (PDF plugin):'''
    #*From within your existing Adobe Reader ('''<u>if you have it already installed</u>'''):
    #**Open the Adobe Reader program from your Programs list
    #**Click Help > Check for Updates
    #**Follow the prompts for updating
    #**If this method works for you, skip the "Download complete installer" section below and proceed to "After the installation" below
    #*Download complete installer ('''if you do <u>NOT</u> have Adobe Reader installed'''):
    #**Use the links below to avoid getting the troublesome "getplus" Adobe Download Manager and other "extras" you may not want
    #**Use Firefox to download and SAVE the installer to your hard drive from the appropriate link below
    #**Click "Save to File"; save to your Desktop (so you can find it)
    #**After download completes, close Firefox
    #**Click the installer you just downloaded and allow the install to continue
    #***Note: Vista and Win7 users may need to right-click the installer and choose "Run as Administrator"
    #**'''<u>Download link</u>''': ftp://ftp.adobe.com/pub/adobe/reader/
    #***Choose your OS
    #***Choose the latest #.x version (example 9.x, for version 9)
    #***Choose the highest number version listed
    #****NOTE: 10.x is the new Adobe Reader X (Windows and Mac only as of this posting)
    #***Choose your language
    #***Download the file, SAVE it to your hard drive, when complete, close Firefox, click on the installer you just downloaded and let it install.
    #***Windows: choose the .exe file; Mac: choose the .dmg file
    #*Using either of the links below will force you to install the "getPlus" Adobe Download Manager. Also be sure to uncheck the McAfee Scanner if you do not want the link forcibly installed on your desktop
    #**''<u>Also see Download link</u>''': http://get.adobe.com/reader/otherversions/
    #**Also see: https://support.mozilla.com/en-US/kb/Using+the+Adobe+Reader+plugin+with+Firefox (do not use the link on this page for downloading; you may get the troublesome "getplus" Adobe Download Manager (Adobe DLM) and other "extras")
    #*After the installation, start Firefox and check your version again.
    #'''Update the [[Managing the Flash plugin|Flash]] plugin''' to the latest version.
    #*Download and SAVE to your Desktop so you can find the installer later
    #*If you do not have the current version, click on the "Player Download Center" link on the "'''Download and information'''" or "'''Download Manual installers'''" below
    #*After download is complete, exit Firefox
    #*Click on the installer you just downloaded and install
    #**Windows 7 and Vista: may need to right-click the installer and choose "Run as Administrator"
    #*Start Firefox and check your version again or test the installation by going back to the download link below
    #*'''Download and information''': http://www.adobe.com/software/flash/about/
    #**Use Firefox to go to the above site to update the Firefox plugin (will also install plugin for most other browsers; except IE)
    #**Use IE to go to the above site to update the IE ActiveX
    #*'''Download Manual installers'''.
    #**http://kb2.adobe.com/cps/191/tn_19166.html#main_ManualInstaller
    #**Note separate links for:
    #***Plugin for Firefox and most other browsers
    #***ActiveX for IE
    #'''Update the [[Java]] plugin''' to the latest version.
    #*Download site: http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE)
    #**'''''Be sure to <u>un-check the Yahoo Toolbar</u> option during the install if you do not want it installed.
    #*Also see "Manual Update" in this article to update from the Java Control Panel in Windows Control Panel: http://support.mozilla.com/en-US/kb/Using+the+Java+plugin+with+Firefox#Updates
    #* Removing old versions (if needed): http://www.java.com/en/download/faq/remove_olderversions.xml
    #* Remove multiple Java Console extensions (if needed): http://kb.mozillazine.org
    #*Java Test: http://www.java.com/en/download/help/testvm.xml

  • Disallow check-in of certain types of files

    Hey
    We want to be able to reject check-in of certain types of files (for example, executables, videos, exremely large documents).
    I am thinking that the best way of doing this would be to develop a filter that intercepts the check-in service and fails the check-in if the file meets specified criteria.
    Anyone have any thoughts on this. Is there an easier way (existing components or config)?
    Thanks,

    There's a couple of posts on this topic - check for instance this one: Restricting Content that can be checked in

  • 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

  • What is the next step after editing or triming a video ? What type of file format to save and what to do after that ?

    what is the next step after editing or triming a video?
    what type of file format should be save and what to do after that?

    In the early days of digital video editing, an export render could take hours!  Not many applications are as hard on system resources as video editing, and rendering the final edit is probably the most system intense action of all.  
    Head on over to the Premiere Pro Hardware forum to see what sort of computer hardware the pros use for NLE (non linear editing), or to the PPBM5 site for a better look.
    PPBM5 Benchmark
    Also check out the specs on the Video Guys website

  • Function module to check if a given file/folder path is valid or not?

    Hi,
    I am using function modules GUI_DOWNLOAD and GUI_UPLOAD.
    Is there any function module to check if a given file/folder path is valid or not?
    Thanks.

    Hi Kumar ,
    REPORT  zdir_test.
    TYPE-POOLS: abap.
    DATA: v_dir TYPE string.
    DATA: v_bol TYPE abap_bool.
    v_dir = 'c:\sap\'.
    CALL METHOD cl_gui_frontend_services=>directory_exist
      EXPORTING
        directory            = v_dir
      RECEIVING
        result               = v_bol
      EXCEPTIONS
        cntl_error           = 1
        error_no_gui         = 2
        wrong_parameter      = 3
        not_supported_by_gui = 4
        OTHERS               = 5.IF NOT v_bol IS INITIAL.
      WRITE:/ 'Directory exists.'.
    ELSE.
      WRITE:/ 'Directory does not exist.'.
    ENDIF.
    Regards,
    Sachin M M

  • Recently upgraded to a Canon Mark 3 and now having issues with my RAW files in Bridge and Photoshop. I am operating with CS4. Photoshop produces an error " Could not complete your request because photoshop does not recognize this type of file"

    Recently upgraded to a Canon Mark 3 and now having issues with my RAW files in Bridge and Photoshop. I have operating with CS4. Photoshop produces and error " Could not complete your request because photoshop does not recognize this type of file"

    Assuming you mean 5D Mark III, Photoshop CS4 cannot directly open raw files from your camera.
    Generally speaking, Adobe stopped updating older versions to be able to read raw files from newer cameras when they released a new major version of Photoshop. Photoshop CS4 is no longer receiving Camera Raw updates.
    You can double check this yourself:
    First you need to determine whether Adobe has released support for your new camera in your version of Photoshop. To do that, look at these two pages. You'll want to find out the earliest version of Camera Raw that can support your camera, then what version of Photoshop can run that version of Camera Raw.
    Camera Raw plug-in | Supported cameras
    Camera Raw-compatible Adobe applications
    If you find your camera is supported by your version of Photoshop, you need to download the latest update for Camera Raw. There's more information on how to do that here:
    Keeping Photoshop Up-To-Date
    If your version of Photoshop cannot support your camera, you can download and install the latest version of the free Adobe DNG Converter, which can take your raw files as input and put out DNG format files, which your version of Photoshop can open.
    Photoshop Help | Digital Negative (DNG)
    The DNG converter DOES work, but if you want maximal quality from your raw files (not to mention the convenience and ease of use of directly opening your raw files) you'll want the latest version of Photoshop. Adobe has made substantial improvements in raw conversion quality in recent years.
    -Noel

  • I keep getting the message: "what should firefox do with this file" in Windows XP every time I want to download a file, e.g., adobe, excel, etc. How can this annoying message be deleted? The check box to "open file automatically" does not work!

    I keep getting the message: "what should Firefox do with this file" in Windows XP every time I want to download a file, e.g., adobe, excel, etc. How can this annoying message be deleted? The check box to "open file automatically" does not work!

    cor-el,
    Thanks for your prompt reply. However, the sources you gave do not seem to apply exactly to my situation. I have attached some screenshots that show what the dialogue box looks like for a pdf download, and what my settings in the Apps panel of Options are. You will note in the first screenshot that I have checked the box to handle this file type automatically; however, the next time I try to download a file of that type, the same dialogue box appears looking exactly like the one shown, so checking the "automatic" option appears to do nothing. The files to be downloaded from my Gmail messages are not generic or altered file types - they are shown as pdf, doc, docx, etc. So while your intent was good, your post did not help. Thanks anyway.

  • .RW2 File "Cannot open because it is the wrong type of file" - P.E. 9

    I just got the new Panesonic Lumix DMC-G3 and took some pictures with it today and found that Photoshop Elements couldn't open the pictures because they were the "wrong type of file".  Now the file format is a  Raw .RW2 and I have opened many of them before in the past and they have been just fine! I think it may be that Photoshop isn't updated yet, because I checked and I had no new updates but do any of you have any ideas as to how I could fix this?! (Besides switching to JPEG)
    ADOBE IF YOU SEE THIS PLEASE UPDATE YOUR SOFTWARE SO YOUR CONSUMERS CAN OPEN THE LUMIX DMC-G3'S RAW FILES! THANK YOU!

    Every camera model has its own raw format, and Adobe can't update the camera raw plug-in until it gets the information from the manufacturer, and the process takes a while. You shouldn't have to wait more than a couple of months for this. In the meantime you can use the manufacturer's software, or try downloading the latest DNG converter to see if it can make DNG files from your camera that will work in ACR.
    Incidentally, you're not talking to adobe here, just to other users like yourself.
    The standlalone DNG converter download is here:
    http://www.adobe.com/downloads/updates/
    Just pick the DNG Converter  for your platform from the pulldown menu.

  • Checking filename length in File Browse item before uploading

    I have a File Browse item from which users can upload files into the database. Within APEX, the file metadata and content first get uploaded into the view WWV_FLOW_FILES. By design apparently, the underlying table for this view has a NAME field which is limited to 90 characters. I would like to test the length of the Name field and provide a warning to the user if the name exceeds 90 characters, but any validation I write to that effect does not "fire" until after the file has been uploaded to the WWV_FLOW_FILES view. That attempt to upload apparently is the first thing that happens when you Submit with a File Browse item, even before the validation. If the name of the file exceeds 90 characters in length, the attempted upload errors out with a generic Page Not Found error. Is there any way to capture the length of the Name of the file with a File Browse item prior to the attempt to upload to the WWV_FLOW_FILES view, or is my only option just to put a warning banner on the page?

    Hello Mike,
    >> Column NAME in WWV_FLOW_FILES is VARCHAR2(90). It does not include the local filename path. It include a prefix like "F1521676842/" in the front of the filename.
    Yes, you are correct. I spoke from memory, and it seems that I remembered one of my customized tables, where I also save the local full path of the file.
    As far as I can see in my system, the extension of the ‘F123….’ is not with a fix length, and the highest one is 18 characters long. Therefore, it seems that the actual file name should be less than 70 characters long.
    A similar code to the following can be used in a validation check:
    <script type="text/javascript">
    function checkFileName(pThis){
      if (pThis.value != "") {
         //get path value (including file name)
         var fileAndPath = pThis.value;
         //find the index of the last "\"
         var lastPathDelimiter = fileAndPath.lastIndexOf("\\");
        //get everything after the last "\"
        var fileNameOnly = fileAndPath.substring(lastPathDelimiter+1);
        if (fileNameOnly.length >70) {
          alert("File name " + fileNameOnly +
              " is too long (" + fileNameOnly.length + " characters).");
          pThis.focus();
    </script>The “HTML Form Element Attributes” of the item should include:
    onblur=" checkFileName(this)"
    Regards,
    Arie.

  • [svn] 1555: Reverting my previous check-in as these files were supposed to go to 3.0.x .

    Revision: 1555
    Author: [email protected]
    Date: 2008-05-05 08:01:54 -0700 (Mon, 05 May 2008)
    Log Message:
    Reverting my previous check-in as these files were supposed to go to 3.0.x. My TortoiseSVN got confused for some reason (I probably copied hidden svn files without realizing)
    Removed Paths:
    blazeds/trunk/apps/team/features/messaging/selector/messaging_AMF_Poll_Subtopic.mxml
    blazeds/trunk/apps/team/features/messaging/selector/messaging_HTTP_Poll_Subtopic.mxml

    Hi Chris,
                  First of all, the entire context of the xsd is too long, it could discourage other people from reading the entire post. Please refrain from posting the entire document.
                  The xsd is not well-formed, that should explain the errors that you are getting when activating the external definition. I'm pasting a valid xsd that could be read in XI: It should look like this (this is a simple example only)
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
    <xs:complexType name="Details">
         <xs:sequence>
              <xs:element name="Location" type="xs:string" minOccurs="0"/>
              <xs:element name="product" type="xs:string" minOccurs="0"/>
              <xs:element name="MovementType" type="xs:string" maxOccurs="9999" />
         </xs:sequence>
    </xs:complexType>
    <xs:element name="Flat" type="sh:Details"/>
    </xs:schema>
    You may need to recode the same XSD to fit like the structure above...
    Regards

  • Howto dispay image from binary type

    Hi, I have sucesfully displayed picture from context of type "Resource" to an Image child with binded to it context of type String. I use to it belov listed piece of code and it works fine:
    FileResource = value attribute if type com.sap....Resource
    Image = value attribut of type String binded to Image child
    if (element.getFileResource() != null) {
    element.setImage(element.getFileResource().getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()));
    Now I have encountered closely related problem (there is a smile with coding an upload as well but I was able to upload "something" != null.). I have a picture in Binary type (uploaded from mysql db). How do I display it in an Image child with String type context (you can bind other types of context to Image child than String)? Below code how I upload the image:
    ResultSet rs = stUpdate2.executeQuery("SELECT * FROM photo");
         while(rs.next())
              byte[] b=rs.getBytes(1);
    IWDResource res=WDResourceFactory.createCachedResource(b,"Image4",WDWebResourceType.JPG_IMAGE);                    IPrivateMyProjectView.IImageTableElement imageEle=wdContext.createImageTableElement();
         imageEle.setImage3(b); //this is probably wrong, I tried bot "setImage3(res)" but I get error
    //The method setImage3(byte[]) in the type IPrivateKartaPolakaView.IImageTableElement is not applicable for //the arguments (IWDResource)
    //or
    //imageEle.setImage3( res.getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()));
    //               wdContext.nodeImageTable() .addElement(imageEle );
    //how it should be but that provides me "The method setImage3(byte[]) in the type //IPrivateMyProjectView.IImageTableElement is not applicable for the arguments (String)" error
    wdContext.nodeImageTable().addElement(imageEle );
    ImageTable = Value Node
    Image3 = value attribute of type binary
    Please advice. Regards, Balmer.

    Hi,
    First of all, make a string context attribute, and bind ur image UI element's source name to it.
    Then write the following code:
    IWDResource l_resource = WDResourceFactory.createCachedResource(<variable of type byte[] whihch has the binary type>,"MyImage",WDWebResourceType.JPG_IMAGE);
    String l_image = l_resource.getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal());
    now set this l_image to the source context attribute.
    check it out and let me know if it works.....
    Regards,
    Gita

  • How to identify binary vs ASCII file???

    Hello,
    What is the best way to decide whether a file is binary or plain text?
    Thanks in advance.
    Chris.

    Other than passing through the bytes, check that there are no bytes that you wouldn't usually have in a text file and pray that the file isn't in an "exotic" character encoding such as utf8?
    There is no real difference. Both "binary" and "text" files contain bytes.

  • Regarding type of file

    hi,
        which function module is used to know type of file(like DAT,TXT,ASCII...).
    Thanks & Regards,
    Rajani.

    Hi Rajni,
    The Function Module FILE_GET_NAME will give the logical file path, fromwhich you can know the file type, I think.
    Just check it out.
    Thanks and regards
    Vipin Das

Maybe you are looking for

  • Anyone using HiddenMail? Does it still work?

    Hello all. I have been using HiddenMail for a while, to launch Mail at startup and hides Mail (Somehow, putting Mail in Login Startup Items and check 'hide' doesn't hide it) But somehow with the latest OS Update, HiddenMail doesn't do its thing: Hide

  • 5800 SMS Problem

    Hello, I bought my Nokia 5800 from the UK and received it on Friday. Everything works great except when i try to send a sms it wont send, the sms is just saved in the outbox saying ".. will be sent again at 00:43" for example. Then i wait until 00.43

  • Connecting Airports around the house

    I have an Airport Express in one room where my office is and I have my Stereo in another room. Is it possible to get another Airport or Airport Express and bounce the signal to the other room so that I can play Itunes on it. Plus, I want better recep

  • I want to copy Thunderbird from Vista to Windows 7 - including all messages and address book

    I tried to do this using Windows Easy Transfer but it didn't work properly. It only transferred the basic Thunderbird setup and loaded messages which were left on the server but not the address book or the emails on Vista which I want to keep. Frustr

  • Retrieve java VM -X parameters at run-time

    I know we can use System.getproperties() to get back all the -D java arguments. Is there a way to get -X arguments e.g. -Xmx256M?