Webdynpro to limit MIME types and size

Hi,
I need to write an web dynpro application to limite the file type and size using IWDFileUpload API, does anyone has some suggestion ?
Thanks a lot.
Kind regards
Ben.J.

Hi Ben,
I think you can restrict the file type and and also check the file size before uploading the file. You need to write the logic to check out the file type.
Use the following code to check restrict the file upload of only txt file...
          IPrivateTestView.ITestElement pf =
               wdContext.nodeTest().currentTestElement();
          IWDMessageManager mgr = wdComponentAPI.getMessageManager();
          if (pf.getFileResource().getResourceType().getFileExtension() != null
               && pf
                    .getPatchResource()
                    .getResourceType()
                    .getFileExtension()
                    .equalsIgnoreCase(
                    "txt")) {
// Check if file size is in valid range.. call getFileSize()
mgr.reportSuccess("File can be uploaded");
          } else {
               mgr.reportException("Kindly upload ont TXT files", false);
And use following code for calculating File Size:
     private String getFileSize(IWDResource resource) {
          InputStream stream = null;
          DecimalFormat myFormatter = new DecimalFormat("###.##");
          double size = 0;
          String unit = "";
          try {
               stream = resource.read(false);
               size = stream.available();
               if (size < 1024) {
                    unit = " Bytes";
               } else if (size < 1048576) {
                    size = size / 1024;
                    unit = " KB";
               } else if (size < 1073741824) {
                    size = size / 1024 / 1024;
                    unit = " MB";
          } catch (IOException e) {
               wdComponentAPI.getMessageManager().reportException(
                    e.getLocalizedMessage(),
                    true);
          } finally {
               if (stream != null) {
                    try {
                         stream.close();
                    } catch (IOException e) {
                         wdComponentAPI.getMessageManager().reportException(
                              e.getLocalizedMessage(),
                              true);
          return myFormatter.format(size) + unit;
          //@@end
This way you can restrict the users. As far as I know there is no standard way of restricting the same
Hope it helps
Regards
Abhinav

Similar Messages

  • Limit file type and size in Solution Manager

    Dear gurus,
    I'm writing an inquiry about the possibility of specifying file extension type and the size the user can upload to solution manager, for example in roadmap / configuration.
    I.e, we need to limit the user not to upload *.avi extension type, and limiting the size to 5MB.
    Thanks for help.
    Regards,

    Hi Bobby,
    Once you insert a file extension in table SADOCGENERIC,  after that, all documents with this file extension will be open and
    should be editable out-of-place with no edit restrictions. You'll just need to have a way to edit it in your computer.
    Kind regards, Fabricius

  • TYPE and SIZE, 2 more columns to the variable in the Command behavior?

    DW 8.02 added 2 more columns to the variable in the Command
    behavior, TYPE and SIZE. What do you put in here?
    What is the difference for Access text, Date/Time, number and
    Memo columns.
    The Dreamweaver DOCS don't cover this update and you can't OK
    the COMMAND without these two columns

    This will be of some help:
    http://www.w3schools.com/ado/ado_datatypes.asp
    You should be able to gather the column size from the
    database's table
    definition. Typically, columns that hold text are one byte
    per character
    (two for Unicode), whereas integers are 4 bytes. Other
    numeric types and
    date types vary among database systems.
    "lovewebdev" <[email protected]> wrote in
    message
    news:ec0it5$h20$[email protected]..
    > DW 8.02 added 2 more columns to the variable in the
    Command behavior, TYPE
    > and
    > SIZE. What do you put in here?
    > What is the difference for Access text, Date/Time,
    number and Memo
    > columns.
    >
    > The Dreamweaver DOCS don't cover this update and you
    can't OK the COMMAND
    > without these two columns
    >

  • Mime Types and site validation?

    When validating site, I'm getting the the following warning
    Conflict between Mime Type and Document Type
    The document is being served with the text/html Mime Type
    which is not a
    registered media type for the XHTML 1.1 Document Type. The
    recommended
    media type for this document is: application/xhtml+xml
    I work with ASP and I can't figure out why, really, it's
    doing this nor
    can I figure out how to solve it.
    I use: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
    http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    and everything validates fine except for this last thing.

    .oO(Art)
    >When validating site, I'm getting the the following
    warning
    >-------------------------
    >Conflict between Mime Type and Document Type
    >
    >The document is being served with the text/html Mime Type
    which is not a
    >registered media type for the XHTML 1.1 Document Type.
    The recommended
    >media type for this document is: application/xhtml+xml
    >-------------------------
    >I work with ASP and I can't figure out why, really, it's
    doing this nor
    >can I figure out how to solve it.
    XHTML 1.1 documents should be delivered as
    application/xhtml+xml. This
    is not recommended, since IE doesn't support this MIME type.
    So switch
    back to XHTML 1.0 Strict, which can also be delivered as
    text/html.
    Micha

  • Get Uploaded File Mime Type and Client Filename

    Anyone know how to recover an uploaded file MIME type and
    client file name?
    I'm writing my own cfx tag to process file uploads and pretty
    much have it figured out except to determine the name of the client
    file and mime type. The formfield file variable value contains the
    path/filename to the CF temp directory, but I need the MIME type,
    filename, etc. that is contained int he HTTP Header
    (e.g. Content-Disposition: form-data; name="Image";
    filename="C:\test.JPG"
    Content-Type: image/pjpeg
    [empty line])
    I'm using the getHttpRequestData() functiont, but it only
    gives me the content-type multipart/form-data, leaving out the Mime
    type and Content-Disposition (which contains the client file name).

    Hi Daniel,
    do you use EPG, mod_plsql or APEX Listener? Have you changed the connection mechanism after upgrading to 4.2.1?
    If you use the APEX Listener, which version do you use? Which browser and version do you use to upload the file? Does it reproduce with other browsers as well?
    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

  • Set default font type and size in formcreated using Acrobat X Pro

    I have a word document that I used Acrobat X Pro to create a PDF and then a Form.  The Form has over 200 text fields.  Is there a way to globally set the font type and size to one type, for instance Arial 10 so that when someone opens the Form and fills it in, the global font type and size is preset         

    Are you talking about fields that you create manually or field created with the Form Wizard? Exactly what version of Acrobat are you using? What OS?
    In any case, using a script is a quick and easy approach:
    for (var i = 0; i < numFields; i++) {
        var fName = getNthFieldName(i);
        var f = getField(fName);
        if (f.type === "text") {
            f.textFont = font.Times;
            f.textSize = 9;
            // Other properties go here
    I use this type of thing all the time to quickly alter a form. Such a script isn't added anywhere, just executed (e.g., JavaScript console). Over time a developer can build up a collection of utility scripts that can do all sorts of things to dramatically speed up development. It would be bad if this option were not available.
    If there is a bug, it should certainly be addressed, so don't think I'm arguing against that, but I'm not seeing it on any of my systems. I can successfully set the default field properties by selecting "Use Current Properties as New Defaults". The Form Wizard does not use these defaults, but that's a different matter.

  • Show columns for song "Type" and "Size" in v8 list view?

    I often sort songs and audio files by either type (mp3 / aif / AAC), or size (how many MB.)
    I can't find how to reveal these columns in v8 -- in 7 i would use command-J to reveal the "view options" dialog, then simply check the boxes to display "type" and "size"
    The new View Options dialog only has a few options for columns.
    Where did they go?
    Thanks.

    Try right clicking at the top of any column and choosing from the list that appears. If you what to display the file format/type (MP3, AAV etc.)choose "Kind".

  • Portlet image type and size

    Hi
    Are there any particular iamge types and size required for portlet banner, header,
    footer, etc...?
    Thanks a lots

    No. It all depends on what type of images your browser can render and
    the real-estate you have on the browser.
    Subbu
    david wrote:
    Hi
    Are there any particular iamge types and size required for portlet banner, header,
    footer, etc...?
    Thanks a lots

  • Automatically open file based on MIME type and file extension

    We have an app that is registered to handle custom MIME type and file extension. This works perfectly on IE and FireFox causing them to download the file to a temp folder and then launch our app associated with MIME type and file extension with command line to the downloaded file. On Safari however this does not work. It opens up a download window and shows that it has downloaded the file with no option to open it.

    hello, you can file a bug on bugzilla.mozilla.org if you want to include your plugin in the plugin finder service...
    [https://wiki.mozilla.org/PFS]

  • Mime-types and schemas

    Hi
    after my last update yesterday I have got some problems with some mime-types. Directly after the update pacman said the following:
    Warning in file "/usr/share/applications/nautilus-folder-handler.desktop": usage of MIME type "x-directory/gnome-default-handler" is discouraged ("x-directory" is an old media type that should be replaced with a modern equivalent)
    Warning in file "/usr/share/applications/nautilus-folder-handler.desktop": usage of MIME type "x-directory/normal" is discouraged ("x-directory" is an old media type that should be replaced with a modern equivalent)
    Error in file "/usr/share/applications/oraclexe-readonlinehelp.desktop": "Application/database" is an invalid MIME type ("Application" is an unregistered media type)
    Error in file "/usr/share/applications/oraclexe-startdb.desktop": "Application/database" is an invalid MIME type ("Application" is an unregistered media type)
    Warning in file "/usr/share/applications/chromium-browser.desktop": usage of MIME type "x-directory/webdav" is discouraged ("x-directory" is an old media type that should be replaced with a modern equivalent)
    Warning in file "/usr/share/applications/chromium-browser.desktop": usage of MIME type "x-directory/webdav-prefer-directory" is discouraged ("x-directory" is an old media type that should be replaced with a modern equivalent)
    I also get a similar message when I try to install awn-extras from AUR altough it is installable (but not fully functional).
    (1/1) Installiere awn-extras-bzr [#####################] 100%
    I/O warning : failed to load external entity "/usr/share/gconf/schemas/awn-extras.schemas"
    »/usr/share/gconf/schemas/awn-extras.schemas« konnte nicht geöffnet werden: Datei oder Verzeichnis nicht gefunden
    It says, that the schema isnt found. Do you have any solutions?
    ~kiro

    .oO(Art)
    >When validating site, I'm getting the the following
    warning
    >-------------------------
    >Conflict between Mime Type and Document Type
    >
    >The document is being served with the text/html Mime Type
    which is not a
    >registered media type for the XHTML 1.1 Document Type.
    The recommended
    >media type for this document is: application/xhtml+xml
    >-------------------------
    >I work with ASP and I can't figure out why, really, it's
    doing this nor
    >can I figure out how to solve it.
    XHTML 1.1 documents should be delivered as
    application/xhtml+xml. This
    is not recommended, since IE doesn't support this MIME type.
    So switch
    back to XHTML 1.0 Strict, which can also be delivered as
    text/html.
    Micha

  • Saving multiple file types and sizes

    I design logos using Illustrator. After the design is approved I need to save it in multiple different file types and sizes. (ie. Jpg Hi, Med, Lo; tif; eps; pdf)
    Does anyone know of a script that can do this?
    Thanks,
    Mark

    I don't know of an existing script that does exactly this. You could make one though. Saving an Illustrator document to both 'eps' and 'pdf' formats is very straight forward once you know which options you want. Personally I would use Photoshop to create the required 'jpegs' Illustrator does not export to any given resolution only scaling at 72dpi… Open either the 'eps' or 'pdf' in Photoshop resize and save 3 times.

  • [svn] 1607: Set svn:mime-type and svn: eol-style on LICENSE and NOTICE files in the lib directory.

    Revision: 1607
    Author: [email protected]
    Date: 2008-05-07 17:02:39 -0700 (Wed, 07 May 2008)
    Log Message:
    Set svn:mime-type and svn:eol-style on LICENSE and NOTICE files in the lib directory.
    Modified Paths:
    flex/sdk/branches/3.0.x/lib/batik-NOTICE.txt
    flex/sdk/branches/3.0.x/lib/commons-discovery-LICENSE.txt
    flex/sdk/branches/3.0.x/lib/xalan-NOTICE.txt
    flex/sdk/branches/3.0.x/lib/xerces-LICENSE.txt
    Property Changed:
    flex/sdk/branches/3.0.x/lib/batik-LICENSE.txt
    flex/sdk/branches/3.0.x/lib/batik-NOTICE.txt
    flex/sdk/branches/3.0.x/lib/commons-collections-LICENSE.txt
    flex/sdk/branches/3.0.x/lib/commons-discovery-LICENSE.txt
    flex/sdk/branches/3.0.x/lib/commons-logging-LICENSE.txt
    flex/sdk/branches/3.0.x/lib/commons-logging-NOTICE.txt
    flex/sdk/branches/3.0.x/lib/mm-velocity-LICENSE.txt
    flex/sdk/branches/3.0.x/lib/mm-velocity-NOTICE.txt
    flex/sdk/branches/3.0.x/lib/xalan-LICENSE.txt
    flex/sdk/branches/3.0.x/lib/xalan-NOTICE.txt
    flex/sdk/branches/3.0.x/lib/xerces-LICENSE.txt

    Thanks for your attention.
    In the above logs, higher resolutions seems to be detected on both screens, hence my surprise :
    [ 391.631] (II) intel(0): Printing probed modes for output LVDS1
    [ 391.631] (II) intel(0): Modeline "1600x900"x60.0 110.00 1600 1664 1706 2010 900 903 906 912 -hsync -vsync (54.7 kHz eP)
    [ 391.897] (II) intel(0): Printing probed modes for output HDMI1
    [ 391.897] (II) intel(0): Modeline "1680x1050"x59.9 119.00 1680 1728 1760 1840 1050 1053 1059 1080 +hsync -vsync (64.7 kHz eP)
    If it can help here is also my current xrandr output (after having called it manually to use the preferred resolution of each screen)
    itanguy ~ $ xrandr
    Screen 0: minimum 320 x 200, current 1680 x 1050, maximum 8192 x 8192
    LVDS1 connected 1600x900+0+0 (normal left inverted right x axis y axis) 309mm x 174mm
    1600x900 60.0*+ 40.0
    1024x768 60.0
    800x600 60.3 56.2
    640x480 59.9
    VGA1 disconnected (normal left inverted right x axis y axis)
    HDMI1 connected 1680x1050+0+0 (normal left inverted right x axis y axis) 434mm x 270mm
    1680x1050 59.9*+
    1280x1024 75.0 60.0
    1152x864 75.0
    1024x768 75.1 60.0
    800x600 75.0 60.3
    640x480 75.0 60.0
    720x400 70.1
    DP1 disconnected (normal left inverted right x axis y axis)
    HDMI2 disconnected (normal left inverted right x axis y axis)
    HDMI3 disconnected (normal left inverted right x axis y axis)
    DP2 disconnected (normal left inverted right x axis y axis)
    DP3 disconnected (normal left inverted right x axis y axis)
    If needed, I may reboot and provide xrandr output after boot (it will be 1024x768), or could other logs help you ? Please ask...

  • Add font types and sizes to ICWC HTML e-mail editor

    Hi,
    I'm working with ICWC e-mail component and I'm wonder to know how can I add more font types and sizes to HTML e-mail editor. At the moment i just have 5 font types and a few font sizes.
    Thanks a lot in advance,
    Nuno Moreira

    Hello Nuno,
    Just try this:
    First you have to upload your .ttf font by using se73 transaction.
    Then you must map it, using this tables:
    SAP: TBTFFONTMAPDEF
    Customer: TBTFFONTMAP
    Just add a line in customer table TBTFFONTMAP with your font (or existing one), and the language that will be used by the users (It accepts wildcard * for all languages)
    And it's done.
    Best Regards,
    Bruno

  • Modifying Java font type and size

    Hi! I'm not sure if this is the right forum for this but I might as well try. I play a lot of Yahoo Chess which uses a java software to launch its program. I'm a new Macbook user and before when I was in Windows/PC, the font type and size setting was okay. Now I barely can read the font whenever I launch Yahoo Chess (using Java) in my Macbook.
    Any help would be appreciated. Thanks!
    Macbook Core 2 Duo with 2 GB Ram   Mac OS X (10.4.9)  

    Hi,
    Which font and font size did you use in your applet? Do you have sample code that could demonstrate the problem? This may have to do with the difference in font aliasing between MS VM and Sun JVM.
    Stanley Ho
    Java Deployment Tech Lead
    Sun Microsystems

  • Limit File Type and file size in attachment table.

    Dear All,
    I want to limit file type like .jpg,.mpgv files while ataching files in attachment table in oracle apps. Also want to limit file size.
    Please help.
    Thanks

    Refer below link regd implementing file upload:
    File Upload
    We can get file type using
    DataObject fileUploadData =
    (DataObject)pageContext.getNamedDataObject("fileInput2");
    //here OAFileUploadBean is "fileInput2"
    String contentType = fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");
    Based on this file type write your login in processFormRequest.
    Will let you know if I find anything about size also.
    -Anand

Maybe you are looking for

  • Iphone 4 slow after IOS 8 upgrade

    I've upgraded my phone to IOS 8.0.2 and I've noticed a substantial decrease in both performance and ability to use SIRI.    Apps load incredibility slow and SIRI is painfully slow.    At least 8 seconds to load, and then another 8 to 10 to get the ap

  • I can't find filter gallery in PS CC2014?

    I used to use Elements but since subscribing to PSCC 2014 filter galleries has disappeared from the filter menu. I use a Mac. Any help greatly appreciated. Regards Libby

  • Pointer to structure in parameter list of DLL

    I want to use the CALL_LIBRARY_FUNCTION to access a function in a DLL which returns a pointer to a structure in its parameter list. How can I access this structure under LabVIEW 6.02? What is the parameter type I have to select in the CALL_LIBRARY_FU

  • Hi Experts, the result of a table content in se16n?

    Hi Experts, in the ALV output of se16n, some columns are in green, what does this stand for? thanks. Kind regards Dawson

  • Won't restore Ipod

    My computer says "iTunes could not contact iPod software update server because you are not connected to the internet" when I clearly am. How can I restore my iPod?