Can we limit the file type in Attachment?

Hi,
Is it possible to limit the file types that the OAF attachment can upload?
Thanks!
Edited by: maeve on Apr 17, 2011 7:09 PM

Hi Maeve
You can make use of below code in pfr method of controler
if(pageContext.getParameter("FileUpload") != null)
DataObject fileUploadData = (DataObject)pageContext.getNamedDataObject("Bean id of OAFileUploadBean ");
String contentType = fileUploadData.selectValue(null, "UPLOAD_FILE_MIME_TYPE");
//Write logic here to limit the file type
}For more details read JavaDoc as well as refer below thread
File Upload
Hope it helps!!!
Thanks
AJ

Similar Messages

  • Page Snapshot on Mac using Shift+Command+4, can I change the file type?

    Is there a way to have this feature save the screen shot as a .jpg or something other than .png?
    Thanks for The help!

    Actually you can change the file type, using a defaults write command in Terminal. Whatever you select changes the file type for all screenshots until/unless you globally change it again. All OnyX does is run this command in the program's interface--if you don't know how to use Terminal you may prefer this. If you want to use Terminal, you would launch it, then copy this command:
    defaults write com.apple.screencapture type jpg
    Paste it into the Terminal window and then press the Return key. I believe you need to restart for the change to take effect.
    Francine
    Francine
    Schwieder

  • Can i change the file type on itunes? they arent compatible with my mp3

    is there a way to change the file to a wma or mp3? please help before i brain myself with the keyboard ^^

    wma is Windows Media Player format so no to that. mp3 can be done of course. In the importing section of preferences you can set what kind of file is created when ripping CDs.

  • How to limit the file types to be uploaded to KM folders?

    We need to restrict files uploaded to KM to the following types: *.pdf, *.doc, *.ppt, and *.xls.  Uploading the other file types will need to give user an error message. 
    1) Is there a configuration to satisfy this requirement?
    2) If not, what is the work-around? How to we achive this goal?       
    For example:
    1. Go to u2018Private Documents and Discussionsu2019 hyper link.
    2. Click on Owner.
    3. Click on 'Send E-mail' hyperlink
    4. Click on the 'Browse' button, selects a file (with .exe extension)
    5. Click on 'Open' button and 'Upload' button (would like to give user an error message at this point)
    Thank you so much for your help.  I have searched the forum but did not find any specific answers to this issue.

    Hello,
    I have the same problem, unfortunatelly there's no standard way to do this and developing
    custom repository services or upload commands may not attend totally my requirements.
    An idea is to create FSDB CM Repositories or to map external File System repositories for
    specifics needs, so once the documents are stored into a file system (windows in my case)
    it's simple to implement the organization's policy, be it file types, maximum folder size, clean-up routines, etc..
    However there are pros and cons, some services are not available and there are some restrictions,
    here's more detailed information: http://help.sap.com/saphelp_nw04/helpdata/en/62/468698a8e611d5993600508b6b8b11/frameset.htm
    As for the original folders on DB mode, we've been running KM detailed reports once a week
    and deleting the "illegal" files found
    kind regards,
    Rafael

  • How can I see the files that are attached to appointments in outlook

    I store files in my appointments in Outlook on my work server that contain travel details, meeting agendas etc. I need to be able to access these on my ipad yet I can't find any way of making them come across to iCal.

    You might want to review the Time Machine Tutorial, and perhaps browse Time Machine - Frequently Asked Questions.

  • Mailexample.sql how do you determine the file type?

    I'm using the mailexample.sql which explains how to use the demo_mail wrapper package for utl_smtp. There's a procedure for attaching text files and a procedure for attaching binary files. I've got binary files to attach to email successfully.
    How can I determine the file type so that I can use the attach_text procedure when attaching text files rather than the procedure for attaching binary files?
    Sandy

    Watch out! I think there is a bug in that code :-
    bug with PL/SQL Sample - maildemo.sql
    To answer your question - the usual way of determining a file type is to look for 'magic numbers' in the file that indicate its type. For example, Windows exe files often (always?) begin with the two letters 'MZ'. Zip files begin with 'PK'; Rar archives begin with 'Rar!'. Text files can begin with anything, and do not have any characteristic marker, but USASCII7 (which is what the format that routine is designed for - I think), is a characterset that only uses the first 7 bits of the byte. You could read the file, and if you find any bytes > 127, then you know it is not a USASCII7 file. I have seen various programs that 'sample' the first 64 or 256 bytes of a file instead of reading the whole file, and they usually get it right.
    Hope this helps.
    Takmeister

  • Email attachment - can't find the file

    I'm using Oracle 9 and I am trying to use it to send an email. I know the version of Oracle is important with this task since sending an email changed in Oracle 10, I think.
    I want it to go to the hard drive and find an attachment to send. I'm okay at SQL/PL and I'm reviewing someone else's code and trying to make it work for me. It sends the mail find, but it can't seem to find the file for the attachment. What is wrong with attaching the file here or the file path?
    thank you.
    daniel
    DECLARE
            v_From           VARCHAR2(80) := '[email protected]';
            v_Recipient     VARCHAR2(80) := '[email protected]';
            v_Subject       VARCHAR2(80) := 'To the moon - and beyond!';
            v_Mail_Host    VARCHAR2(30) := '10.0.31.20';
            v_Mail_Conn utl_smtp.Connection;
            crlf                VARCHAR2(2)  := chr(13)||chr(10);
            pivAttached    VARCHAR2(4000)   := 'C:\Documents and Settings\dkessler\My Documents\PERM\Other\sql_emails\Perm_sel_vw_form_cc_ltd_20110526.txt';
              lvDirectory       VARCHAR2(100);
              lvFileName        VARCHAR2(100);
              lvLine            VARCHAR2(1000);
              lvMessage         VARCHAR2(32767);
              lvCc              VARCHAR2(100);
              lnCcCount         NUMBER(8);
              lnLastSemiColon   NUMBER(8);
              lnCurSemiColon    NUMBER(8);     
              TYPE lTypeFile IS TABLE OF VARCHAR2(200)
                INDEX BY BINARY_INTEGER;
              lTabFile           lTypeFile;
              lvFileHandle       sys.UTL_FILE.FILE_TYPE;
              lvSlashPosition         NUMBER;
              lvMessageLength    NUMBER;
              leMessageTooLong   EXCEPTION;
              leInvalidPath      EXCEPTION;
              lvMessageLengthgthExceeded   BOOLEAN := FALSE;
              pinMaxSize    NUMBER DEFAULT 9999999999;
            --rpt_name varchar2(50);
    BEGIN
            v_Mail_Conn := utl_smtp.Open_Connection('10.0.31.20', 25);
            utl_smtp.Helo(v_Mail_Conn, v_Mail_Host);
            utl_smtp.Mail(v_Mail_Conn, v_From);
            utl_smtp.Rcpt(v_Mail_Conn, v_Recipient);
            --rpt_name:='Perm_sagitec2011_UPD_user_access_fix_'||to_char(sysdate,'YYYYMMDD')||'.xls';
            --demo_mail.begin_attachment(v_Mail_Conn => v_Mail_Conn,mime_type => 'Application/Excel', inline => TRUE, filename => rpt_name);
            utl_smtp.Data(v_Mail_Conn, 'Date: '   || to_char(sysdate, 'Dy, DD Mon YYYY hh24:mi:ss') || crlf ||
                                                    'From: '   || '[email protected]' || crlf ||
                                                    'Subject: '|| v_Subject || crlf ||
                                                    'To: '     || v_Recipient || crlf ||
                                                     'Content-Type: multipart/mixed; boundary="DMW.Boundary.605592468"' || crlf ||
                                                      '--DMW.Boundary.605592468' || crlf ||
                                                      'Content-Type: text/plain; charset=US-ASCII' || crlf ||
                                                      'Content-Disposition: inline;' || crlf ||
                                                      'Content-Transfer-Encoding: 7bit' || crlf ||
                                                    crlf ||                                
                                                    'This is body text.'|| crlf
           --demo_mail.end_attachment(conn => conn);
                                         -- locate the final '/' or '\' in the pathname ...
                         BEGIN
                                 lvSlashPosition := INSTR(pivAttached, '/', -1 );
                                 IF lvSlashPosition = 0 THEN
                                    lvSlashPosition := INSTR(pivAttached, '\', -1 );
                                 END IF;
                                 -- separate the filename from the directory name ...
                                 lvDirectory     := SUBSTR(pivAttached, 1, lvSlashPosition - 1 );
                                 lvFileName      := SUBSTR(pivAttached, lvSlashPosition + 1 );
                                 -- open the file ...
                                 lvFileHandle := UTL_FILE.FOPEN(lvDirectory, lvFileName, 'r' );
                                 -- generate the MIME boundary line ...
                                 lvMessage := crlf || '--DMW.Boundary.605592468' || crlf ||
                                 'Content-Type: application/octet-stream; name="' || lvFileName || '"' || crlf ||
                                 'Content-Disposition: attachment; filename="' || lvFileName || '"' || crlf ||
                                 'Content-Transfer-Encoding: 7bit' || crlf || crlf ;
                                 lvMessageLength := lvMessageLength + LENGTH(lvMessage);
                                 utl_smtp.write_data ( v_Mail_Conn, lvMessage );
                                 -- and append the file contents to the end of the message ...
                                 LOOP
                                     UTL_FILE.GET_LINE(lvFileHandle, lvLine);
                                     IF lvMessageLength + LENGTH(lvLine) > pinMaxSize THEN
                                        lvMessage := '*** truncated ***' || crlf;
                                        utl_smtp.write_data ( v_Mail_Conn, lvMessage );
                                        lvMessageLengthgthExceeded := TRUE;
                                        RAISE leMessageTooLong;
                                     END IF;
                                     lvMessage := lvLine || crlf;
                                     utl_smtp.write_data ( v_Mail_Conn, lvMessage );
                                     lvMessageLength := lvMessageLength + LENGTH(lvMessage);
                                 END LOOP;
                              EXCEPTION
                                 WHEN NO_DATA_FOUND THEN
                                   NULL;
                                 WHEN UTL_FILE.INVALID_PATH THEN
                                   RAISE_APPLICATION_ERROR (-20101,'Invalid path while opening attachment '||pivAttached );
                                 WHEN OTHERS THEN 
                                   RAISE;
                              END;
                              lvMessage := crlf;
                              utl_smtp.write_data ( v_Mail_Conn, lvMessage );
                              -- close the file ...
                              UTL_FILE.FCLOSE(lvFileHandle);
           utl_smtp.Quit(v_mail_conn);
           --pivAttached
    EXCEPTION
    WHEN utl_smtp.Transient_Error OR utl_smtp.Permanent_Error then
       raise_application_error(-20000, 'Unable to send mail: '||sqlerrm);
    END;
    /

    The important thing is that a file attachment does not mean pointing the mail API at a file and say "+attach thyself+".
    In technical terms, the attachment is simply another piece in the mail (aka MIME) body. There can be numerous "pieces" - separated by text boundary lines. Each piece with is own header and data.
    So an e-mail with an attachment does not mean mail arrives with a file piggybacking on it. It means a MIME body with multiple "pieces". Where one such "piece" is the uu-encoded contents of the file, with is header describing what the contents is.
    Depending on the mail API your code use, your code may need to construct this entire MIME (e-mail) body - including reading the original file, encoding it if binary, and inserting that as a "piece" into the MIME body.
    This you would do when for example using UTL_SMTP - as it only does the SMTP protocol part (the conversation with the mail server) and not the constructing MIME body part.
    If you for example use UTL_MAIL, it generates a (very basic/primitive) MIME body and uses UTL_SMTP to transmit it. UTL_MAIL expects you to pass the file contents to insert as a "piece" into the MIME body as a LOB. Not as a physical path or UNC that points to some file somewhere. Your code needs to read that content of the file into a LOB... and then call UTL_MAIL.
    As your code is PL/SQL, it is server side code. It runs inside an Oracle server process. If the file contents to attach is on the client, then that client (browser, Java, TOAD, .Net, Perl, whatever) needs to read that local file's content and use DBMS_LOB calls to instruct PL/SQL on the server to create a LOB containing that contents. Then the PL/SQL code can call UTL_MAIL and tell it to write the contents of that LOB into the MIME body of the e-mail.

  • When I attach a JPG file in my email and send it to a Windows friend they get the message "The file type being saved or retrieved has been blocked when they try to open it." Anyone know why and how to fix this problem?

    When I attach a JPG file in my email message and send it to a Windows friend they get the message "The file type being saved or retrieved has been blocked when they try to open it so that they can save it." Anyone know why and how to fix this problem?

    Your Windows friend should ask in a Windows forum why his email client won't open attached jpg files. We have no idea what email client he is using or how his Windows security is configured.

  • Using an F2100 printer & can't scan to pdf there is no option in the file type menu there used be ?

    Using an F2100 printer &  can't scan to pdf there is no option in the file type menu there used be ? I'm using xp but had an hp update and have the problem tried unistalling and reinstalling the HP software and even using system restore to be the update .I hope it is just a setting or something simple. Is there another software I can use ? Many thanks

    Follow steps 1 and 2 of this tutorial and you will be able to get a jpg file for each of your book's pages inported into iPhoto: 06 - Creating an iDVD Slideshow From an iPhoto Book.  If you don't have the Automator workflow Save PDF to iPhoto (which should be in the HD/Library/PDF Services folder) you can download it from Toad's Cellar.
    Happy Holidays

  • HT4863 How can I increase the file size limit for outgoing mail. I need to send a file that is 50MB?

    How can I increase the file size limit for outgoing mail. I need to send a file that is 50MB?

    You can't change it, and I suspect few email providers would allow a file that big.  Consider uploading it to a service like Dropbox, then email the link allowing the recipient to download it.

  • I can't get the file attachment in a web form to work

    I have a web form made in Business Catalyst that I'm having some problems with. I have added a file attachment option, but I can't get this to work properly.
    When a user chooses a file and sends the form, the message that is being sent includes the name of the file that was attached, but not the file itself! What am I doing wrong?
    This is the web form (in Norwegian, but you get the idea of where the file upload is) In this form, the file "produktark_plusstjenester.pdf" has been attached.
    The e-mail that is being sent now looks like this (I have removed the private information). But as you can see, it mentions the file produktark_plusstjenester.pdf (94,45 kb), but it is not attached in the e-mail itself.
    Hope someone can clarify this for me

    File on web forms is attached to the case. Go to the case in the admin and you can retrieve the file.

  • How can I limit the size of a file upload?

    I am uploading a file using a file reference using the code below.  I want to  limit the file size (bytes) of the uploaded file to 100k, so that a huge file won't crash the browser or my SWF.
    What's the best place in the following process to test this, and actually prevent the large file from being loaded?  Is that even possible?
    private function uploadImageBtn_clickHandler() : void {
         var arr:Array = [];
         arr.push(new FileFilter("Images", "*.gif;*.jpeg;*.jpg;*.png"));
         fileRef.browse(arr);
    private function fileReference_select(evt:Event):void {
         fileRef.load();
    private function fileReference_complete(event:Event):void {
         var loader:Loader = new Loader();
         loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loader_complete);
         loader.loadBytes(fileRef.data);
    public function loader_complete (event:Event) : void {
         trace("Loader info = "+event.currentTarget.bytesLoaded); // file size in bytes
         var sourceBMP:Bitmap = event.currentTarget.loader.content as Bitmap;
         bgImage.source = sourceBMP; 

    Thank you. I just needed to be pointed in the right direction. After looking over this stuff, including FilePermission, I think this may give me what I was looking for. It will be a while before I get to implementing it or testing something like this, I'm just trying to get a grasp on all of the things I need to do and how to approach it.
    By doing this I can control how much filespace it can use.
    I can control CPU usage by monitoring for extra threads that don't belong and killing or settings the priority on it.
    Now I just need to think of something to monitor how much memory the plugin uses. I suppose I could gc, then store the current memory usage, then execute the plugin, gc again, and measure the size again. Does that sound like a reasonable way to estimate it's memory usage? I'm not looking for tiny changes, I just want to see large, substantial increases.

  • HT5409 I asked if AVCHD files can be played on Mac and the support site says to simply click on the icon and quick time will play it. A big lie. Just say it won't support the file type and tell us what apps to get.

    I asked if AVCHD files can be played on Mac and the support site says to simply click on the icon and quick time will play it. A big lie. Just say it won't support the file type and tell us what apps to get. anybody?

    I also had issues opening AVCHD files on case-sensitive filesystems.
    You can try these steps to solve the issue:
    Right click on the AVCHD file and select 'Show Package Contents'
    Right click on the BDMV file and select 'Show Package Contents'
    Rename index.bdm to INDEX.BDM (it seems that all files in the BDMV folder should be in UPPERCASE for Quicktime to open the AVCHD file).
    Go back twice and try again to double-click on the AVCHD file (Quicktime should open a window showing the multiple clips, as expected).

  • HT2729 I have limited space on my new ipad. How can I limit the number of songs from my itunes on my imac from going to my ipad when I connect the two?

    I have limited space on my new ipad. How can I limit the number of songs from my itunes on my imac from going to my ipad when I connect the two?

    you can do this by keeping the external hard drive connected and doing the following
    -hold shift key down on computer while opening iTunes and a prompt will appear to choose a library
    -select choose library, iTunes should bring up your explorer windows where you can search for the external HD
    -after you find the external HD find the iTunes folder you just copied to it
    -after opening the iTunes folder look for the file that says iTunes library.itl or if you can't see that extenstion just look for a document looking thing in the iTunes folder that shows up as a database file
    -double click the database file and boom iTunes should load your library without having to copy it to the computer
    PS: do make sure that if you are going to do it this way, make sure that the external HD is connected at all times, because if you don't then you will get exclamation marks next to your iTunes songs
    double PS: if you are unsure how to find out if the iTunes library file is a database file just right click it and choose properties and under the type it should say database file
    hope this helps:)

  • External table, can't see the file

    Hi
    --This is what I do
    CREATE OR REPLACE DIRECTORY data_dir AS 'C:\TEMP\'
    GRANT READ, WRITE ON DIRECTORY data_dir TO my_user;
    --I have my actual GAS.TXT file in the folder, the file looks like this
    0003450305NG-5E6, TUSCANY VILLAS,26 FENTON STREET ROTORUA 3201, ROTORUA
    002343043NG-9DE, LORALIS LIMITED,18 HARINGTON STREET TAURANGA 3001, TAURANGA
    ...etc...
    --I do a select
    SELECT * FROM all_directories
    --and it shows
    SYS DATA_DIR C:\TEMP\
    --Then I create my ext table like this
    CREATE TABLE external_table(
    ICP CHAR(10) ,
    NAME CHAR(20),
    ADDRESS CHAR(30),
    CITY CHAR(20)
    ORGANIZATION EXTERNAL
    ( TYPE oracle_loader
    DEFAULT DIRECTORY DATA_DIR
    ACCESS parameters
    (RECORDS DELIMITED BY NEWLINE
    FIELDS TERMINATED BY ','
    OPTIONALLY ENCLOSED BY '"' AND '"'
    (ICP CHAR(40),
    NAME CHAR(100),
    ADDRESS CHAR(100),
    CITY CHAR(100)
    location (DATA_DIR:'GAS.TXT')
    --The table is created
    --then when I try and do a select I end up with an error message
    SELECT * FROM EXTERNAL_TABLE
    ORA-29913 blah, blah
    ORA-29400 blah blah
    KUP-04040 file can't be found
    ORA-06512 SYS.ORACL_LOADER
    ORA-06512 blah blah
    So, I reckon of some reason it can't see the file, but I do not know why?
    The file sits on the Server in the C:\TEMP folder and the error log ends up in the C:\TEMP folder
    I have tried several variations on this, but still same error. However, then I also tried these exact same scripts on another Oracle box, and it worked fine. So something with the machine/box I am using is not alright.
    Would appreciate your thoguhts.
    Thanks
    Kari

    As suggested, change your table definition to match the available data, and post an example like below with complete error message (not the edited version that is hard to understand).
    SQL> $ type c:\temp\gas.txt
    0003450305NG-5E6, TUSCANY VILLAS,26 FENTON STREET ROTORUA 3201, ROTORUA
    002343043NG-9DE, LORALIS LIMITED,18 HARINGTON STREET TAURANGA 3001, TAURANGA
    SQL> CREATE OR REPLACE DIRECTORY data_dir AS 'C:\TEMP\'
      2  /
    Directory created.
    SQL> CREATE TABLE external_table(
      2  ICP CHAR(16) ,
      3  NAME CHAR(20),
      4  ADDRESS CHAR(35),
      5  CITY CHAR(20)
      6  )
      7  ORGANIZATION EXTERNAL
      8  ( TYPE oracle_loader
      9  DEFAULT DIRECTORY DATA_DIR
    10  ACCESS parameters
    11  (RECORDS DELIMITED BY NEWLINE
    12  FIELDS TERMINATED BY ','
    13  OPTIONALLY ENCLOSED BY '"' AND '"'
    14  (ICP CHAR(40),
    15  NAME CHAR(100),
    16  ADDRESS CHAR(100),
    17  CITY CHAR(100)
    18  )
    19  )
    20  location (DATA_DIR:'GAS.TXT')
    21  )
    22  reject limit unlimited
    23  /
    Table created.
    SQL> select * from external_table ;
    ICP              NAME                 ADDRESS
    CITY
    0003450305NG-5E6 TUSCANY VILLAS       26 FENTON STREET ROTORUA 3201
    ROTORUA
    002343043NG-9DE  LORALIS LIMITED      18 HARINGTON STREET TAURANGA 3001
    TAURANGA
    2 rows selected.
    SQL>Message was edited by:
    Kamal Kishore

Maybe you are looking for

  • How can i watch video on IPAD screen with Apple TV?

    i have apple tv and itune libary on the same network. i am wondering if i can watch movies stored in the libary on the ipad screen without turning on the tv or the computer. i have no problem watch the movies on TV thru apple tv. thanks.

  • Missing items in list view

    Notice the info panel that shows Caption and Keyword: But in List View, notice that the Keyword is missing: It's inconsistent, too. Some photos show keywords, some don't, even though all of the actually DO have keywords (same one, in fact): Must be a

  • Assigning the COD to Company Code - Error

    Hello Gurus,                       My client has a company code in Canada, but wants to follow US book methods for depreciation. The client also wants the methods that are preconfigured..i mean pre-delivered through SAP. So, the problem is that when

  • IChat no longer connects

    I have used iChat many times early in the year with no problems. I have not used iChat over the past several months. Recently I started using it again and I am having problems connecting. I am constantly getting error codes -7 & -8 Recently my son go

  • Problems displaying Thai characters in FTE components on Mac

    I had originally posted a question here: http://forums.adobe.com/message/4027591, but was told that this is more of a flash runtime issue. I am running into issues displaying Thai characters in Flex components that make use of the Flash Text Engine (