Validate by file type?

Is there a way to validate file type for images uploaded via a web form?
We need to restrict files to .jpg, .png, or .gif.
Thanks,
Tim

Hi Mike!
I did not find your BADI in the system I currently have access (maybe a release or installed package problem) - but still I like to give you a hint.
There is a class CL_GUI_FRONTEND_SERVICES with the method FILE_GET_SIZE. At least for a path/filename to a local file you can get the attributes of the file with this function.
Regards,
Christian

Similar Messages

  • How to validate the file path when downloading.

    Hi
    How to validate the file path when downloading to Presentation or application Server.

    hiii
    you can validate file path by following way
    REPORT zvalidate.
    TYPE-POOLS: abap.
    DATA: w_direc TYPE string.
    DATA: w_bool TYPE abap_bool.
    w_dir = 'c:\Myfolder\'.
    CALL METHOD cl_gui_frontend_services=>directory_exist
    EXPORTING
    directory = w_direc
    RECEIVING
    result = w_bool
    EXCEPTIONS
    cntl_error = 1
    error_no_gui = 2
    wrong_parameter = 3
    not_supported_by_gui = 4
    OTHERS = 5.
    IF NOT w_bool IS INITIAL.
    WRITE:/ 'Directory exists.'.
    ELSE.
    WRITE:/ 'Directory does not exist.'.
    ENDIF.
    regards
    twinkal

  • How to Get File type in webdynpro abap

    Hi,
    I am using File Upload UI element of webdynpro ABAP to upload data  into SAP table. I want that the file type should only be tab delimited. How to get the file type to validate the same.
    Regards,
    Dhiraj Mehta

    hi,
    just follow the link :
    http://help.sap.com/saphelp_40b/helpdata/en/2a/fa02b7493111d182b70000e829fbfe/content.htm
    Hope this will help u!!!
    thanks & regards,
    punit raval.

  • How to  validate a file  given the file name and the path

    hi ,
      is their any function module which can validate a file present in the presentation server given its filename and path name

    Hi,
    Refer Sample Code Below:
    Selection Screen
    SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
    PARAMETERS : rb_pc  RADIOBUTTON GROUP r1 DEFAULT 'X', "For Presentation
                 p_f1   LIKE rlgrap-filename,            
    SELECTION-SCREEN END OF BLOCK b1.
    SELECTION-SCREEN SKIP.
    AT SELECTION-SCREEN ON p_f1.
      IF  p_f1 IS INITIAL.
        MESSAGE e000(zmm) WITH text-002. ' Enter File Path
      ENDIF.
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_f1.
    *-- Browse Presentation Server
      PERFORM f1000_browse_presentation_file.
    FORM f1000_browse_presentation_file .
      CONSTANTS: lcl_path TYPE char20 VALUE 'C:\Migration Files\'.
      CALL FUNCTION<b> 'WS_FILENAME_GET'</b>
        EXPORTING
          def_path         = lcl_path
          mask             = c_mask  "',.,..'
          mode             = c_mode
          title            = text-006
        IMPORTING
          filename         = p_f1
        EXCEPTIONS
          inv_winsys       = 1
          no_batch         = 2
          selection_cancel = 3
          selection_error  = 4
          OTHERS           = 5.
      IF sy-subrc <> 0.
        MESSAGE s000 WITH 'No file Selected'.
        flg_pre = c_x.
      ENDIF.
    ENDFORM.                    " f1000_browse_presentation_file
    *&      Form  f1001_browse_appl_file
          Select file from Application Server
    FORM f1001_browse_appl_file.
      DATA:  lcl_directory  TYPE char128,
             lcl_file       TYPE char10.
      lcl_directory  = p_direct.
      CALL FUNCTION <b>'/SAPDMC/LSM_F4_SERVER_FILE'</b>
        EXPORTING
          directory        = lcl_directory
          filemask         = c_mask
        IMPORTING
          serverfile       = p_f2
        EXCEPTIONS
          canceled_by_user = 1
          OTHERS           = 2.
      IF sy-subrc <> 0.
       MESSAGE e000(zmm) WITH text-039.
       flg_app = 'X'.
      ENDIF.
    ENDFORM.                    " f1001_browse_appl_file
    *&      Form  f1003_pre_file
          Open Presentation Server file
    FORM f1003_pre_file .
      DATA: lcl_filename TYPE string.
      CONSTANTS: lc_codepage(3) TYPE c VALUE 'IBM',        " Code page
                 lc_filetype    TYPE char10 VALUE 'ASC'.
      lcl_filename = p_f1.
      CHECK p_f1 IS NOT INITIAL.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename                = lcl_filename
          filetype                = lc_filetype
          has_field_separator     = c_x
        TABLES
          data_tab                = i_reg_grp
        EXCEPTIONS
          file_open_error         = 1
          file_read_error         = 2
          no_batch                = 3
          gui_refuse_filetransfer = 4
          invalid_type            = 5
          no_authority            = 6
          unknown_error           = 7
          bad_data_format         = 8
          header_not_allowed      = 9
          separator_not_allowed   = 10
          header_too_long         = 11
          unknown_dp_error        = 12
          access_denied           = 13
          dp_out_of_memory        = 14
          disk_full               = 15
          dp_timeout              = 16
          OTHERS                  = 17.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    <b>Reward points if this helps.
    Manish</b>

  • What are the differences in file types?

    what are the differences in file types?    HOW DO i CONVERT TXT TO A FILE TYPE THAT PLAYS MUSIC/VIDEO?

    Every file on a computer is ultimately just a big collection of zeros and ones. Files with the .txt extension typically contain just text. If opened with a suitable program such as Notepad the text will be readable. Try to push the same file into a different application and you may get nonsense or crash the software. Well written software will attempt to validate the internal structure of the file it is given and reject anything it doesn't know how to handle. There are multiple audio file formats. Transcoding an audio file from one audio format to another is possible. Changing a text file into audio isn't possible unless it wasn't really a text file in the first place.
    tt2

  • Webstart - Registering a custom file type

    I'm trying to use a jnlp file to register a custom file type (*.flf) with Windows XP / Vista. I have added the following line to the jnlp file near the bottom (right by the main class tag):
    <association extensions="flf" mime-type="application-x/flf" />On some sites I have found this listed as mime type first and extensions second and also with just a > no the end without a />. Neither seems to be working. I also found it listed inside the information section but this didn't work either.
    Am I missing something blindingly obvious? For reference heres the entire jnlp file
    <?xml version="1.0" encoding="utf-8"?>
    <!-- JNLP File for SimpleExample Application -->
      <jnlp codebase="http://ukpcw032:8080/jclock" href="jFreelancer.jnlp">
        <information>
           <title>CVC Freelancer Time Sheets</title>
           <vendor>CVC</vendor>
           <description>CVC Freelancer Time Sheets - Program to allow freelancers to generate their time sheets for submission.</description>
           <description kind="short">Fee</description>
           <offline-allowed/>
           <icon href="images/overview.png" />
           <icon kind="splash" href="images/splash.jpg" with="365" height="260"/>
           <shortcut>
           <desktop/>
           <menu submenu="CVC"/>
           </shortcut>
         </information>
         <resources>
           <j2se version="1.6"/>
           <jar href="jFreelancer.jar"/>
           <jar href="libs/mysql-connector-java-5.1.6-bin.jar"/>
           <jar href="libs/iText-2.1.3.jar"/>
           <jar href="libs/DateChooser.jar"/>
           <jar href="libs/dsn.jar" />
           <jar href="libs/imap.jar" />
           <jar href="libs/pop3.jar" />
           <jar href="libs/smtp.jar" />
           <jar href="libs/mailapi.jar" />
         </resources>
         <security>
           <all-permissions/>
         </security>
         <association extensions="flf" mime-type="application-x/flf" />
         <application-desc main-class="freelancer.UserLogin"/>
    </jnlp>

    That JNLP file is invalid. Try this variant..
    <?xml version="1.0" encoding="utf-8"?>
    <!-- JNLP File for SimpleExample Application -->
      <jnlp codebase="http://ukpcw032:8080/jclock" href="jFreelancer.jnlp">
        <information>
           <title>CVC Freelancer Time Sheets</title>
           <vendor>CVC</vendor>
           <description>CVC Freelancer Time Sheets - Program to allow freelancers to generate their time sheets for submission.</description>
           <description kind="short">Fee</description>
           <icon href="images/overview.png" />
           <icon kind="splash" href="images/splash.jpg" width="365" height="260"/>
           <offline-allowed/>
           <shortcut>
           <desktop/>
           <menu submenu="CVC"/>
           </shortcut>
         <association extensions="flf" mime-type="application-x/flf" />
         </information>
         <security>
           <all-permissions/>
         </security>
         <resources>
           <j2se version="1.6"/>
           <jar href="jFreelancer.jar"/>
           <jar href="libs/mysql-connector-java-5.1.6-bin.jar"/>
           <jar href="libs/iText-2.1.3.jar"/>
           <jar href="libs/DateChooser.jar"/>
           <jar href="libs/dsn.jar" />
           <jar href="libs/imap.jar" />
           <jar href="libs/pop3.jar" />
           <jar href="libs/smtp.jar" />
           <jar href="libs/mailapi.jar" />
         </resources>
         <application-desc main-class="freelancer.UserLogin"/>
    </jnlp>I also have a demo of the [FileOpen/SaveService|http://pscode.org/jws/api.html#fs] that you might also test, but I just noticed that launch file is also slightly invalid. I have seen it work on Win XP using Java 1.6 though.
    Edit 1:
    I used YAXV to validate the launch file against an XSD that is based on the DTD distributed by Sun. YAXV is freeware, and I highly recommend* using it to check the JNLP file(s) for any JWS launch that does not work as expected.
    * OK - I wrote it, so I might be biased. ;-)
    Edited by: AndrewThompson64 on Aug 12, 2008 11:05 PM

  • Validating a file type

    Hi,
    I have a form where files are uploaded to a server. I need to
    prevent certain file types from getting uploaded (e.g, .exe etc.)
    How can I validate the extention of the "upload_file" in the action
    page when the temporary location of the file is gibberish. In the
    action page, this is what is passed for the "upload_file" value:
    /opt/jrun4/servers/cfusion/SERVER-INF/temp/cfusion-war-tmp/neotmp6417.tmp
    Here's the form:
    <cfform action="action.cfm" method="post"
    enctype="multipart/form-data">
    <cfinput name="upload_file" required="Yes" message="Please
    upload a file.">
    ....

    Thanks very much. I wrapped the entire thing in
    <cftry>/<cfatch>.

  • How to filter the file type and size when uploadind files into APEX

    Hi,
    I was wondering how I can do to validate the size of a file, before moving it to my table ? I'd like to filter the file type, but for this one, I think I can use regular expressions in a validation process.
    I don't know if there is a way to read the file size even before sending it into the temporary file table.
    Thank you
    Leinad

    Hello Leinad,
    AFAIK, you have to create an APEX validation (PL/SQL returns Boolean or Returns error text), which will query the file details from apex_flow_files table. Here you can get filetype and size etc.
    So just validate and if any validation fails, then delete the file from apex_flow_files and riase error message.
    Regards,
    Hari
    P.S. Please note that, if there are other apex validations on your page and if they fail, still apex will load the file into apex_flow_files table. So it's good idea to create a validation (PL/SQL) which will fire (condition) when inline validation errors occured. Make sure that this is the LAST validation on your page in sequence. And here you can write code to delete the file from apex_flow_files table.
    Edited by: Hari_639 on Sep 20, 2012 10:09 PM

  • FM to validate the file path on the presentation server.

    Hi all,
                  We are downloading a file on to the presentation server.
    Is there any FM to validate the file path of the presentation server?
    Suggestions are also welcome.
    Regards,
    Sreekar

    You can call a class like a function module. See example below:
    TYPE-POOLS: ABAP.
    DATA: L_DIR TYPE STRING.
    DATA: L_BOL TYPE ABAP_BOOL.
    L_DIR = 'c:\windows'.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_EXIST
      EXPORTING
        DIRECTORY            = L_DIR
      RECEIVING
        RESULT               = L_BOL
      EXCEPTIONS
        CNTL_ERROR           = 1
        ERROR_NO_GUI         = 2
        WRONG_PARAMETER      = 3
        NOT_SUPPORTED_BY_GUI = 4
        others               = 5.
    IF NOT L_BOL IS INITIAL.
      WRITE: / 'Directory exists.'.
    ELSE.
      WRITE: / 'Directory does not exist.'.
    ENDIF.

  • FM to validate the file path on the presenation server.

    Hi all,
    We are downloading a file on to the presentation server.
    Is there any FM to validate the file path of the presentation server?
    Its usgent.
    Thanks and Regards,
    Praveen

    Hi praveen,
    this may probably help you i think
    but its not a fm its a subroutine.
    FORM validate_pre_file USING fp_name TYPE rlgrap-filename.
    DATA : l_result,
    l_filename TYPE string.
    l_filename = fp_name.
    CLEAR l_result.
    CALL METHOD cl_gui_frontend_services=>file_exist
    EXPORTING
    file = l_filename
    RECEIVING
    result = l_result
    EXCEPTIONS
    cntl_error = 1
    error_no_gui = 2
    wrong_parameter = 3
    not_supported_by_gui = 4
    OTHERS = 5.
    IF sy-subrc 0.
    MESSAGE s007 DISPLAY LIKE c_e.
    LEAVE LIST-PROCESSING.
    ELSEIF l_result IS INITIAL.
    MESSAGE s008 DISPLAY LIKE c_e.
    LEAVE LIST-PROCESSING.
    ENDIF.
    ENDFORM. " validate_pre_file_hdr
    regards
    srikanth tulasi.

  • Font file types in EPUB

    Hi,
    From iBooks Asset Guide I read that only TTF and OTF font files are welcome in EPUBs for iBooks and iBookStore. I wonder: is that mandatory?
    I just made an EPUB3 that gather the fonts needed and one of them is a .suit file, not .otf nor .ttf file. It reads perfectly on iBooks, and it doesn't provide any kind of errors in EPUBCHECK. Would it be a problem when trying to deliver it with iTunes Producer ?
    As a side question: do you use to just use iTunes Producer to "validate" your EPUBs seeking possible error message, w/o the intention of sending the file to Apple right after that?
    Thanks!

    Sorry for that, so here is my goal.
    There is a folder contains may types of files: vi, lvlilb, txt and so on... I would like to make a VI that convert a given folder to LBB.
    What file types can be placed insinde and LLB - is required for me to remove unwanted files
    How to programmatically convert a directory into an LLB - I hope there is a VI what I can use as LLB Manager does for converting direcotries to LLB.
    Yes you are right, the last question is not important...
    +++ In God we believe, in Trance we Trust +++
    [Hungary]

  • Restricting File Types in the  "Choose File" window

    hi,
    I am using struts *<html:file>* to upload a file.
    When i click on browse button, one dialog box ie choose file window opens.
    But initially, it shows All Files (*.*) in File types text box. But i want to restrict the user there only to select some specific types.
    I use accept attribute of <html:file> tag and provide value like "*application/pdf,image/jpeg*".
    But it is showing All Files in that choose file window.
    can anybody help me on this?

    there were a way of doing that but using the accept attribute in the input tag like <input type="file" accept"your MIME types">
    but many browsers ignore this attribute and still show all file types.
    another way to solve the problem is to validate the file selected after user clicks ok by java script code.

  • Set file type associations in Adobe Bridge for Photoshop CS6

    Is there a way I can edit the registry so that in Adobe Bridge, under edit, preferences, file type associations, the jpg extension is forced to use the 32-bit version of Photoshop?  I can do it manually, but is there a registry key i can export to apply it to multiple computers?

    Yes, in theory, but it is generally not recommended. But that location would depend on what OS you are on. This video give the locations for the Photoshop files, Bridge would just be in a neighboring folder: http://tv.adobe.com/watch/the-complete-picture-with-julieanne-kost/how-to-reset-photoshop- cs6s-preferences-file/

  • Data Recover From Formatted Drive? What is the best program to use to get back Logic Projects and any other file type?

    I was in the process of reorganising my hard drives so I could RAID them however I managed to corrupt one drive and had to format it which meant I lost all my Logic Files and some other files. I managed to save a lot of files (mainly video files) before I had to format the drive but I need a Data Recovery service that will not alter anything on the hard drive and will put all the formatted files (regardless of the type) back for me so I can get the rest of the ones I need.
    Thanks in advance.

    What about folders and such?
    No. FS doesn't reconstruct folders. However, Data Rescue does, depending on how you use it. About the only thing in Data Rescue a Quick Scan ever seems to show you are files that are already live.
    So that leaves you with a Deep Scan, or a Deleted Files scan. The first pass of a Deep Scan will attempt to retrieve folders and files, along with their original names. The second pass only looks for file patterns. Like recognizing a Photoshop .psd file. It will recover it, but give it a nonsense name. A Deleted Files scan only results in nonsense names of recognized file types; no folders.
    What were you using File Salvage on? A hard drive?
    Yes, though you can use it on a flash drive, or any other mounted drive.
    At the moment it is estimating 289 hours remaining on a 1TB drive. Can it not go faster?
    No, both of the software mentioned are slower than molasses in January. When you delete anything in Windows, its file table entry simply tagged as deleted. So to unerase them, the tag is removed. That's why it works to quickly and easily (assuming you haven't already overwritten the data to be recovered).
    In OS X though, the whole idea of the underlying UNIX structure is all about security. It's not supposed to be easy to retrieve deleted items. When you delete items, their file table entries are erased. So the only way to find deleted items is to scour the entire drive for BOF (Beginning Of File) markers that don't have a matching starting block to anything that is in the file table.
    Another question, half the drive was empty. Will it fly over that empty space or will it sieve through it incase there was some files stored on it?
    If you use the Expert mode is FS, you can choose to do that:

  • File type in GUI_download

    Hi Experts,
    Whatis the coresponding file type for 'WK1 for WS_DOWNLOAD in GUI_DOWNLOAD?

    Hi ravi,
    1. Its the same WK1.
    2. U can check for yourself in the documentation of this parameter in se37.
    regards,
    amit m.

Maybe you are looking for

  • Porting from Oracle 10g AS to Oracle 11g Weblogic server

    Hi, I am trying to port J2EE applicatin from Oracle 10g AS to Oracle 11g Weblogic Server. I have jsp files which contains sql code embedded to fetch data from the DB. The components used in this application are Java, JSP, Servlets and Stateless sessi

  • Looking for a good Video intro generator. Any recommendation ?

    Hi there, I am looking for some impressive video intro generator & bump into this: http://www.reallusion.com/contentstore/cstore_vshowcase.aspx?id=525&CategoryName =iClone I bought the iClone4 plus the Motion Montage because I like the part where it

  • Can't get rid of a 3gp video

    Hey guys...I got a 3gp video on my phone that has an icon on my all screen with the other icons,someone put this video that plays a song on my phone for a joke and it keeps comin on..I tried to delete it but I can't and also can't find it in any fold

  • I download, but always saves files of 1KB.  How can I save the whole file.

    I registered the unlock of QT Pro. I try to download, it tries to save audio file as something.mov, but the file is 1KB in size. It actually does not save the whole thing. How can save the whole file from a URL? Thanks, Juan

  • History on import and export

    MDM can manage history of files imported or exported ?