Obsolete images making my upload file huge?

I just added the same picture to the browser background of all my site's pages (11 in all). Now when I use iWeb to save my site to a folder for uploading to my non .mac hosting site, it has more than doubled in size from 9.8 MB to 21.5 MB. I looked at the Domain.sites2 file that iWeb created when I published it to .mac and it's roughly the same size.
When I looked in the folder where the files get dumped for uploading to an external host, I do indeed find one copy of the image file in the folder for each of my 11 pages. The image size is 1.1 MB. So that times 11 plus the original 9.8 MB size makes sense for the larger file size now.
Is there any way to get around this? I'm guessing the answer is no, but I thought I'd ask anyway. I assumed it would be smart enough to house one copy of the image for all pages it's used in, but I was obviously wrong there. I'm not concerned about space on the host server since I've got way more than I'll ever need, but the upload time is getting very time consuming. Thanks.

What kind of image is it? A JPEG?
You could try running your images through an image optimizer that can reduce the size of your image files before you drag them into iWeb. Chances are you can reduce the image by a few hundred kilobytes which could help speed up the upload.
There are a few ways you can do this. If you have photoshop, you can use some of the built in tools to export your images for the web which will reduce the image size for you.
We have also released a beta version of a new tool we are working on that optimizes your image and web site files. You can use it for free while in beta mode. Instructions on obtaining it can be found at http://www.ragesw.com/forums/index.php?showtopic=1031 and on the WebCrusher website optimizer info page.

Similar Messages

  • Problems uploading images with uppercase (.JPG) file extension.

    I am using coldfusion 8 and have no problems uploading an image using CFFile when the image has a lowercase file extensions such as .jpg however if the same file has a Uppercase file extension .JPG coldfusion hangs and then just times out. The files are exactly the same just different cases in the extensions.
    Any idea?
    My cffile is set as such   <cffile accept="image/*" action="upload" destination="#uploadfolder2#" filefield="profilePictureFileBrowser" nameconflict="makeunique" >
    I tried changing the accept property to image/*, image/jpg, image/JPG but that did not fix the problem either

    Thanks for the quick reply. So I removed the tag and even though I get an error after submitting the form it appears to not hang anyways. Any idea how to fix this?
    I am on a windows 2003 server so cases sensitifity should not be a problem. I am perplexed as to why this would work with lowercase extensions an not upper?

  • Making an Upload image feature

    I’m designing a flash website and I want a feature whereby the user can upload an image and it gets sent to an email at the press of a button. What is the easiest way for this to be done?
    Thanks in advance!

    you'll need to find someone to do this for you or you'll need to advance your skill beyond beginner because this is an intermediate-level task.
    you can start by using google to search for:  flash <your actionscript version> upload file tutorial
    then once you've mastered that, search for:  <your server-side scripting language> email attachment tutorial

  • Different between upload an image and a XML file??

    To uploading an image file then to database, i use the following function:
    " .getLoader().setOrdHttpUploadFile "
    but if I want to upload an XML file, is it work?? If not, how can I do??

    Hi,
    You mention the getLoader() method: are you using BC4J? If so, then you have to write the code yourself. BC4J is integrated with the interMedia database object types, and knows how to handle upload requests to these types. If you want to write a simple BLOB or CLOB column, then you can do so, but you have to write the code. See my reply to your other post below.
    Simon
    <BLOCKQUOTE><font size="1" face="Verdana, Arial, Helvetica">quote:</font><HR>
    Hi,
    When you say: 'i find the class of "intermedia" that it is just use to
    upload image, audio, or video file.', are you referring to interMedia
    Java Classes for Servlets and JSP? If so, you can use these classes to
    upload any document to a BLOB column. Simply select the column from
    the database (using FOR UPDATE), call the OrdHttpUploadFile.loadLob(
    BLOB blob ) method to write the data to the BLOB, then update the BLOB
    column in the database. To write an uploaded document to any other
    data type, such as a CLOB, you would need to read the data from the
    InputStream returned by the OrdHttpUploadFile.getInputStream() method,
    then write it to the data type using whatever mechanism is
    appropriate, taking in to account such things as character set
    conversion.
    Hope that helps,
    Simon
    <HR></BLOCKQUOTE>
    null

  • File Place an image brings in a really huge graphic

    Hi All,
    I have just started using InDesign CS6 and I am trying to place images in between paragraphs of text for a book.
    When I place the image it comes in really huge, breaks the text and disappears, so I can't even see the image to reduce its size. Once I find the image, I use the second pointer and ctrl shift to reduce the size of the panel that the picture is in. This panel outline keeps turning brown and hiding part of the picture instead of reducing its size. When I can get the picture panel outline to turn blue, then I can resize the picture.
    However I find this process really awkward. Is there a better way to bring a picture into an InDesign document at a small, manageable size?
    I find this process with the brown and blue boxes really hard to do, and very hard to understand.
    Thanks for your help folks!

    It sounds like you're jumping in before you have learned the basics of the program. Maybe you don't feel you have the time, but you will probably waste more time poking around trying to find the answers than you would learning the basics at the beginning. Sandee Cohen's book has been recommended by many people as a good place to start, and you will find videos, from the free ones on YouTube to the subscription videos at Lynda.com and other sources, as there's always the tutorials in the InDesign Help file. I can get you over this little hump, but give my suggestion some consideration.
    You can place an object on the pasteboard by not having a text cursor in the text when you place. When the image is ready to be placed, just click somewhere there is nothing and that's where it will make a free-standing image. You can then size the image by using the Selection tool (black arrow) and dragging one of the sides or corners while holding the Command key (Mac OS, probably the Alt key on Windows). If you want the image to resize proportionally, hold the shift and Command before dragging a corner or side. Using the Direct Select (white arrow) will allow you to change the content or the frame (the container) independently, which works well for cropping the image within the container. You can switch between Select and Direct Select by double-clicking on the image, so that might be what's going wrong for you. There is also a circle that appears when you place the cursor over the image, and if you click on it to drag, you move the image inside the frame, but the frame remains stationary (which is another thing that newbies struggle with). Once the image is around the size you want, you can copy it with the Selection tool, switch to the type tool, place the cursor where you want the image to be placed and paste. Also, since InDesign isn't a word processor, you don't need to anchor the image within the text if that isn't what you want. The freestanding image may be placed anywhere you like, and text can be made to wrap around it if you like by going to Window>Text Wrap (wrap is applied to the thing you want to repel the text, so don't apply it to the text itself unless you want the text frame to repel text in other frames).
    That's a start, but you will find things much easier once you do a little homework. Good luck, and come on back if you need help, but as with many online forums, the more you try to help yourself, the better treatment you will get from the forum users who might think you want them to do your work for you. Just sayin…

  • Why do I have "broken image" icons after uploading a file with safari 7.0

    I have a wesite where I can upload images.  We show the directory of uploaded files with an icon that is a thumbnail of the image.  This is working fine with all versions of safari except 7.0.
    All users with 7.0 see the small blue icon with a "?" in place of the thumbnail (png and jpg).  When the full image is displayed it look fine.
    The wierd thing is that if I go to Chrome and view my directory and then go back to safari 7.0 and refresh, all thumbnails appear correctly.
    I suspect there is a bug in Safari 7.0.  Anyone else have this problem?

    Has the 1 year limited hardware warranty expired? Apple would only charge to perform a repair or a replacement. If iOS 7.0.3 caused the issue then that would be a software issue, not hardware. Take it into the Genius Bar because the technicians are the only people that will be able to determine the cause. But if the iPhone needs to be replaced and it is not covered then Apple are in the right. 

  • Multiple Upload Image Problem - Resize GIF files

    The Multiple Image Upload script seems to handle .jpg images without problems.
    However, .gif files return the error:
    "Error converting image (image resize). Image processing library not available or does not support operation. (imagemagick library is not working or not found)."
    The problem is caused by the fact that script that I'm using tries to pass a parameter that is not valid for gif processing:
    myimage.gif' '-quality' '80'
    The "quality" parameter works only for jpeg and .png files as described here:
    http://www.imagemagick.org/script/command-line-options.php#quality
    Please ensure that the script makes difference between .gif and .jpeg files and use the correct parameters so we can resize the images properly.
    Thanks in advance,
    Márcio

    Hi Marcio,
    >>
    Can you tell me the inconveniance of using GD instead of Imagemagick, or its, shortly similar?
    >>
    sorry, but never worked with ImageMagick so far, so I can´t compare
    >>
    The "quality" parameter works only for jpeg and .png files as described here
    >>
    yeah, it seems that this is a small bug in ADDT´s "includes/common/lib/image/KT_Image.class.php" file. Was just checking the code in there, and indeed it adds this extra parameter regardless the image type -- but I do have an idea how this file can be modified to not use this parameter if the file in question has the suffix ".gif".
    If you feel a little adventurous, I´ll happily invite you to modify some code in this file -- please let me know if you´re ready for some instructions. However, if so, please make a backup of this file first...
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • How to SCAN uploaded files for VIRUS in APEX

    part 1:
    Goal:
    Do a virus scan of the uploaded file from APEX application prior to storing the file in custom tables.
    The process:
    Followed the document from www.developer.com:
    Implementing an Anti-Virus File Scan in JEE Applications
    By Vlad Kofman
    Go to page: 1 2 3 Next
    This article will discuss one of the ways to implement antivirus file scanning in Java, particular in the JEE applications. Viruses, Trojan Horses, and different malware and spyware are a real problem for current computer environments, and especially for the Windows operating system. If you are designing any application in Java that has a requirement to be able to upload external files, you have a potential security risk. By uploading, I mean any way to get the external file inside of the corporate firewall be it via HTTP protocol or any other means. It is quite common to have this type of requirement in an enterprise application and with Java being one of the most popular web development platforms, it is unfortunate that this type of gaping security risk is quite often overlooked.
    Java's Development Kit (JDK) does not have any means to do the antivirus scan right out of the box. This is primarily because Java is a programming language, and does not have any virus scanning packages. Furthermore, anti-virus software is not Sun's area of expertise or business model. Developing this type of software (or Java package), and more importantly maintaining it, would be a huge task for Sun. Mainly because viruses are constantly evolving and keeping virus definitions up-to-date is a daunting task. Large companies such as McAffee, Symantec, or Zone Labs develop virus detecting and combating products and spend a lot of resources to maintain them.
    Application Environment
    To implement a virus file scan in Java, a third-party package needs to be used. For the purposes of this article, I will use Symantec Scan Engine (SSE) package, which comes with Java APIs. This package is an application that serves as a TCP/IP server and has a programming interface and enables Java applications to incorporate support for content scanning technologies. For this article, I used Symantec Scan Engine 5.1, which is available as a Unix or Windows install.
    If you are using an anti-virus package from the different vendor, you will need to investigate what kind of APIs are available; however, the general approach should be similar. Also, note that my implementation can be used with JEE technology and any modern MVC framework such as Struts or Spring.
    The architecture is as follows: A server machine needs to have SSE running at all times. This can be the same machine that hosts your Application Server, but in an enterprise environment this should be a different machine. The Default Port needs to be open through the firewall to allow communication with the scan engine. All JEE applications that need to do file scanning can talk to the SSE server machine through a default port. Also, multiple applications running on different application servers can re-use the same scanning server. For more information, you should refer to the Symantec Scan Engine (SSE) Installation Guide, available on the Symantec web site.
    When an external file that needs to be scanned is sent to the SSE via its programming interface (Java APIs using the default port), before any other operation on the file is performed, the SSE returns a result code. For instance, a file is uploaded by an external user into the web email type application as an attachment; then, the SSE API is invoked by the application and the return code of pass or fail determines the outcome of the upload and whether that email can actually be sent. If you have an account on Yahoo mail, you probably have seen that Yahoo is using Norton Antivirus to scan all attachments, although no Java.
    Click here for a larger image.
    Figure 1: Screen shot from Yahoo
    For details on the Scan Engine Server Installationm please see the Symantec Scan Engine (SSE) Implementation Guide from Symantec.
    Here are some key things to remember about SSE:
    •     Java 2 SE Runtime (JRE) 5.0 Update 6.0 or later must be installed on the server before the SSE installation is done.
    •     After installation, verify that the Symantec Scan Engine daemon is running. At the Unix command prompt (if it's a Unix install), type the following command:
    ps –ea | grep sym.
    A list of processes similar to the following should appear:
    o     5358 ? 0:00 symscan
    o     5359 ? 0:00 symscan
    If nothing is displayed the SSE process did not start.
    If the SSE process did not start, type the following command to restart SSE:
    /etc/init.d/symscan restart
    •     Keeping the virus definition up to date is the most important task and if new updates are not installed, the whole scan becomes ineffective. Symantec automatically downloads the most current file definitions through LiveUpdate. Please make sure that firewall rules are in place to allow the host server to connect to the Symantec update service.
    Project Setup
    For the purposes of this article, I included a wrapper for the Symantec SSE APIs, av.jar, which has Symantec Java APIs and serves as a client to the SSE server and takes care of all communications with the server. Please refer to the download source section. The av.jar should be included in the Java CLASSPATH to work with the SSE. This jar contains a class called AVClient that takes care of actually sending the files to SSE as byte arrays and returning the result.
    In my project setting, I added three variables to be accessed via the System.getProperty mechanism. For example:
    AV_SERVER_HOST=192.168.1.150
    AV_SERVER_PORT=1344
    AV_SERVER_MODE=SCAN
    The AV_SERVER_HOST is the host name or IP of the machine where Scan Engine is installed.
    The AV_SERVER_PORT is the port where Scan Engine listens for incoming files.
    The AV_SERVER_MODE is the scan mode which can be:
    •     NOSCAN: No scanning will be done (any keyword that does not start with "SCAN" will result in ignoring the call to the Scan Engine and no files will be transferred for scanning).
    •     SCAN: Files or the byte stream will be scanned, but the scan engine will not try to repair infections.
    •     SCANREPAIR: Files will be scanned, the scan engine will try to repair infections, but nothing else will be done.
    •     SCANREPAIRDELETE: Files will be scanned, the scan engine will try to repair infections, and irreparable files will be deleted.
    Note: For the file stream (byte array) scanning, the only meaning full values are "SCAN" and "NOSCAN".
    Using the SSE Scanning Java APIs
    In any class where scan is required, call the scanning API provided in the AVClient object located in the av.jar. The AVClient object will establish connection to the Scan Engine server and has the following APIs:
    Figure 2: The significant APIs for the communication with to the Scan Engine Server.
    If scanning a file on the file system, in SCAN only mode, use the call that accepts filename only.
    If scanning a file on the file system, with SCANREPAIR or SCANREPAIRDELETE, use the call that accepts input and output file names.
    If scanning an in-memory file (byte array), use the call accepting byte array.
    For example:
    import com.av.*;
    Initialize setup parameters:
    static String avMode =
    (System.getProperty("AV_SERVER_MODE") != null)
    ? (String) System.getProperty("AV_SERVER_MODE") : "NOSCAN";
    static boolean scan = avMode.startsWith("SCAN");
    static String avServer =
    (String) System.getProperty("AV_SERVER_HOST");
    static int avPort =
    Integer.parseInt( (String) System.getProperty("AV_SERVER_PORT"));
    Scan check example for an in-memory file byte array:
    public void scanFile(byte[] fileBytes, String fileName)
    throws IOException, Exception {
    if (scan) {
    AVClient avc = new AVClient(avServer, avPort, avMode);
    if (avc.scanfile(fileName, fileBytes) == -1) {
    throw new VirusException("WARNING: A virus was detected in
    your attachment: " + fileName + "<br>Please scan
    your system with the latest antivirus software with
    updated virus definitions and try again.");
    Note that if you are using this code inside of the MVC handler, you can throw a custom VirusException and check for it in the calling method and perform any necessary cleanup. I have included the class in the AV Jar as well.
    For example:
    catch (Exception ex) {
    logger.error(ex);
    if (ex instanceof VirusException) {
    // do something here
    else {
    // there was some other error – handle it
    For more details on the Scan Engine Client API, please see Symantec Scan Engine Software Developers Guide.
    Continuation in part2

    part 4:
    c)     Clienttester.java – This is the gui app set to test if the configuration is working or not. This gui uses the method scanfile(inputfile, outputfile) as you can see the result in the outputpane of the jframe.
    * clienttester.java
    * Created on April 12, 2005, 2:37 PM
    * @author george_maculley
    package com.av;
    import java.io.*;
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    public class clienttester
    implements ActionListener {
    // private String ipaddress = "127.0.0.1";
    private String ipaddress = "199.209.150.58";
    //private String ipaddress = "192.168.0.55";
    static JFrame frame;
    JFileChooser chooser = new JFileChooser();
    TextField pathtofile = new TextField(System.getProperty("user.home"), 30);
    // TextField pathtooutfile= new TextField(System.getProperty("user.home"),30);
    private int port = 1344;
    JButton filechooser = new JButton("Browse to file"); ;
    private String originalfilename;
    private String outputfilename;
    JButton scanbutton = new JButton("Scan");
    TextArea outputarea = new TextArea(20, 40);
    TextField iptext = new TextField("127.0.0.1", 16);
    TextField porttext = new TextField("1344", 5);
    AVClient mine;
    JRadioButton choosescan = new JRadioButton("SCAN");
    // JRadioButton choosedelete= new JRadioButton("SCANREPAIRDELETE");
    /** Creates a new instance of gui */
    public clienttester() {
    public clienttester(java.lang.String ip, java.lang.String infile, java.lang.String outfile, int port) {
    this.ipaddress = ip;
    this.port = port;
    this.originalfilename = infile;
    this.outputfilename = outfile;
    boolean setValues(java.lang.String ip, java.lang.String infile, java.lang.String outfile, int port) {
    this.ipaddress = ip;
    this.port = port;
    this.originalfilename = infile;
    this.outputfilename = outfile;
    return (true);
    public void actionPerformed(java.awt.event.ActionEvent actionEvent) {
    JComponent c = (JComponent) actionEvent.getSource();
    if (c == filechooser) {
    int retval = chooser.showDialog(frame, null);
    if (retval == JFileChooser.APPROVE_OPTION) {
    File theFile = chooser.getSelectedFile();
    if (theFile != null) {
    pathtofile.setText(theFile.getPath());
    // pathtooutfile.setText(theFile.getPath());
    JOptionPane.showMessageDialog(frame, "You chose this file: " + theFile.getPath());
    if (c == scanbutton) {
    //return object that can be passed to AVClient
    String policy;
    int thisport;
    int scanresult;
    String thisip;
    String inputfile;
    String outputfile;
    outputarea.append("Server: " + iptext.getText() + "\r\n");
    if (choosescan.isSelected()) {
    policy = "SCAN";
    else {
    policy = "SCANREPAIRDELETE";
    thisport = new Integer(porttext.getText()).intValue();
    thisip = iptext.getText();
    //mine= new AVClient(iptext.getText(),porttext.getText(),policy);
    mine = new AVClient(iptext.getText(), thisport, policy);
    if (mine.test() == 1) {
    outputarea.append("Sorry. Incorrect parameters specified.\r\n");
    System.exit(1);
    else {
    outputarea.append("Connection to SAVSE initialized.\r\n");
    inputfile = pathtofile.getText();
    // outputfile=pathtooutfile.getText();
    outputfile = "/tmp";
    outputarea.append("Scanning file " + inputfile + " \r\n");
    if (policy == "SCAN") {
    scanresult = mine.scanfile(inputfile);
    else {
    scanresult = mine.scanfile(inputfile, outputfile);
    if (scanresult == 0) {
    outputarea.append("File is clean.\r\n");
    else if (scanresult == -1) {
    outputarea.append("File is infected. \r\n");
    else {
    outputarea.append("Scan error.\r\n");
    void display() {
    Frame f = new Frame("SAVSE JAVA ICAP Client");
    f.setLayout(new GridLayout(1, 2));
    JPanel lpanel = new JPanel(new GridLayout(7, 1));
    JPanel ippanel = new JPanel();
    JPanel portpanel = new JPanel();
    JPanel rpanel = new JPanel();
    JPanel outputpanel = new JPanel();
    JPanel buttonpanel = new JPanel();
    JPanel pathpanel = new JPanel();
    // JPanel outpathpanel= new JPanel();
    JPanel policypanel = new JPanel();
    ButtonGroup policygroup = new ButtonGroup();
    filechooser.addActionListener(this);
    scanbutton.addActionListener(this);
    choosescan.setSelected(true);
    policygroup.add(choosescan);
    // policygroup.add(choosedelete);
    buttonpanel.setBorder(BorderFactory.createTitledBorder("Scan Policy"));
    buttonpanel.add(choosescan);
    // buttonpanel.add(choosedelete);
    pathpanel.setBorder(BorderFactory.createTitledBorder("Path to File"));
    pathpanel.add(pathtofile);
    f.setSize(new Dimension(650, 400));
    f.setBackground(Color.white);
    f.setResizable(true);
    ippanel.setBorder(BorderFactory.createTitledBorder("SAVSE IP Address"));
    ippanel.add(iptext);
    outputpanel.setBorder(BorderFactory.createTitledBorder("OUTPUT"));
    outputpanel.add(outputarea);
    portpanel.setBorder(BorderFactory.createTitledBorder("ICAP Port"));
    portpanel.add(porttext);
    // outpathpanel.setBorder(BorderFactory.createTitledBorder("Path to Repair File"));
    // outpathpanel.add(pathtooutfile);
    lpanel.add(ippanel);
    rpanel.add(outputpanel);
    lpanel.add(portpanel);
    lpanel.add(buttonpanel);
    lpanel.add(pathpanel);
    // lpanel.add(outpathpanel);
    lpanel.add(filechooser);
    lpanel.add(scanbutton);
    f.add(lpanel);
    f.add(rpanel);
    f.setVisible(true);
    public static void main(String[] args) {
    clienttester g = new clienttester();
    g.display();
    d)     my2.java – This is the class file I wrote to test that I am able to send a file and scan it and see the output in the JDEVELOPER. In this case the file is stored on the filesystem of the client machine. JDEVELOPER should be able to see the file.
    NOTE:
    “EICAR.com” is the test file downloaded from Symantec site to test a non malicious virus file. I n order to be able to test it like this, the Antivirus program running on your machine should be disabled, or else Antivirus will kick in and delete the file. In the first place you will not be able to download the test virus file either with anti virus running on the machine you are downloading to.
    package com.av;
    import java.io.*;
    public class my2 {
    static int my_return = 0;
    * @param fileBytes
    * @param fileName
    * @return
    public static int scanfile(String fileName){
    String avMode = "SCAN";
    boolean scan = avMode.startsWith("SCAN");
    String avServer = "xx";--avserver ip address
    int avPort = 1344;
    int the_return = 0;
    if (scan) {
    AVClient avc = new AVClient(avServer,avPort,avMode);
    the_return = avc.scanfile(fileName);
    if (the_return == -1) {
    return (the_return);
    } else
    return (the_return);
    //my_return = the_return;
    return (the_return);
    public static void main(String[] args) throws Exception {
    System.out.println("Hi there in Main");
    byte[] b1 = new byte[4];
    b1[1] = 68;
    my_return = scanfile("c:\\eicar.com");
    System.out.println(my_return);
    e)     Then finally we have my1.JAVA, which takes the filename, and it’s contents in the bytes form and scans the file. The reason for this method is we are not storing the file on the filesystem, it is read into the memory and only if it is clean, it is put into the database or else notify the user.
    package com.av;
    import java.io.*;
    public class my1 {
    static int my_return = 0;
    static int a_length = 0;
    * @param fileBytes
    * @param fileName
    * @return
    public static int scanfile(String fileName,byte[] fileBytes) throws IOException {
    String avMode = "SCAN";
    boolean scan = avMode.startsWith("SCAN");
    String avServer = "xxx";--avserver’s ip address
    int avPort = 1344;
    int the_return = 0;
    if (scan) {
    AVClient avc = new AVClient(avServer,avPort,avMode);
    // File file = new File(fileName) ;
    //byte[] fBytes = getBytesFromFile(file);
    the_return = avc.scanfile(fileName, fileBytes);
    if (the_return == -1) {
    return (the_return);
    } else
    {return (the_return);}
    my_return = the_return;
    return (the_return);
    // Returns the contents of the file in a byte array.
    * @param file
    * @return
    * @throws IOException
    public static byte[] getBytesFromFile(File file) throws IOException {
    InputStream is = new FileInputStream(file);
    // Get the size of the file
    long length = file.length();
    // You cannot create an array using a long type.
    // It needs to be an int type.
    // Before converting to an int type, check
    // to ensure that file is not larger than Integer.MAX_VALUE.
    if (length > Integer.MAX_VALUE) {
    // File is too large
    // Create the byte array to hold the data
    byte[] bytes = new byte[(int)length];
    // Read in the bytes
    int offset = 0;
    int numRead = 0;
    while (offset < bytes.length
    && (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) {
    offset += numRead;
    // Ensure all the bytes have been read in
    if (offset < bytes.length) {
    throw new IOException("Could not completely read file "+file.getName());
    // Close the input stream and return bytes
    is.close();
    return bytes;
    // public static void main(String[] args) throws Exception {
    //System.out.println("Hi there in Main");
    // File file = new File() ;
    // byte[] b1 = getBytesFromFile(file);
    //System.out.println(b1);
    // my_return = scanfile(,b1);
    //System.out.println(my_return); }
    Finally , you have the exceptions file,
    e) package com.av;
    public class VirusException
    extends Exception {
    public VirusException() {
    super();
    public VirusException(String text) {
    super(text);
    Once you have all these classes, you can use JDEVELOPER , to load these classes into the database: This is as follows:
    Right click on the project, which has all these classes.
    NEW -> deployment profiles -> load java and stored procedures.
    When you are created deployment profile, you have to specify,
    Loadjava options.
    -f, -v (check the check boxes)
    Under privileges:
    -s – specify database schema these classes are loaded into
    -s – create sysnonym check box
    -g – grant to public or any specific users per your policy.
    Under Resolver,
    -r and –o (check the check boxes)
    I accepted the default name storedproc1. Then you right click on the storedproc1.deploy, deploy to whichever database connection you created.
    And then, In order to access this java class we need a pl/sql wrapper as follows:
    create or replace package my1 is
    function mycheck (pfilename in varchar2, psize in number)
    return number;
    end my1;
    create or replace package body my1 is
         function mycheck (pfilename in varchar2, psize in number)
    return number is
    language java
         name 'com.av.my1.scanfile(java.lang.String, byte[]) return int';
         end my1;
    And the code is invoked from sql plus as follows:
    Select my1.mycheck(“filename”, “filebytes”) from dual;
    One important catch in the above method is to send the filename and filecontents in bytes form. In order to send the file contents as filebytes, you will need another java class and load into the data base as described above.
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.IOException;
    import java.io.InputStream;
    * This program demonstrates how to read a file into a byte array. This method
    * reads the entire contents of the file into a byte array.
    * @version 1.0
    * @author Jeffrey M. Hunter ([email protected])
    * @author http://www.idevelopment.info
    public class ReadFileIntoByteArray {
    * method to convert a byte to a hex string.
    * @param data the byte to convert
    * @return String the converted byte
    public static String byteToHex(byte data) {
    StringBuffer buf = new StringBuffer();
    buf.append(toHexChar((data >>> 4) & 0x0F));
    buf.append(toHexChar(data & 0x0F));
    return buf.toString();
    * Convenience method to convert an int to a hex char.
    * @param i the int to convert
    * @return char the converted char
    public static char toHexChar(int i) {
    if ((0 <= i) && (i <= 9)) {
    return (char) ('0' + i);
    } else {
    return (char) ('a' + (i - 10));
    * Returns the contents of the file in a byte array
    * @param file File this method should read
    * @return byte[] Returns a byte[] array of the contents of the file
    private static byte[] getBytesFromFile(File file) throws IOException {
    InputStream is = new FileInputStream(file);
    System.out.println("\nDEBUG: FileInputStream is " + file);
    // Get the size of the file
    long length = file.length();
    System.out.println("DEBUG: Length of " + file + " is " + length + "\n");
    * You cannot create an array using a long type. It needs to be an int
    * type. Before converting to an int type, check to ensure that file is
    * not loarger than Integer.MAX_VALUE;
    if (length > Integer.MAX_VALUE) {
    System.out.println("File is too large to process");
    return null;
    // Create the byte array to hold the data
    byte[] bytes = new byte[(int)length];
    // Read in the bytes
    int offset = 0;
    int numRead = 0;
    while ( (offset < bytes.length)
    ( (numRead=is.read(bytes, offset, bytes.length-offset)) >= 0) ) {
    offset += numRead;
    // Ensure all the bytes have been read in
    if (offset < bytes.length) {
    throw new IOException("Could not completely read file " + file.getName());
    is.close();
    return bytes;
    * @param filename
    public static byte[] chk_file(String filename) {
    byte[] fileArray = null;
    try {
    fileArray = getBytesFromFile(new File( filename));
    } catch (IOException e) {
    e.printStackTrace();
    if (fileArray != null) {
    for (int i=0; i<fileArray.length; i++) {
    System.out.println(
    "fileArray[" + i + "] = " +
    ((int)fileArray[i] < 9 ? " " : "") +
    ( ((int)fileArray[i] > 9 && (int)fileArray[i] <= 99) ? " " : "") +
    fileArray[i] + " : " +
    " HEX=(0x" + byteToHex(fileArray) + ") : " +
    " charValue=(" + (char)fileArray[i] + ")");
    return fileArray;
    * Sole entry point to the class and application.
    * @param args Array of String arguments.
    public static void main(String[] args) {
    byte[] fileArray = null;
    try {
    fileArray = getBytesFromFile(new File("c:\\eicar.com"));
    } catch (IOException e) {
    e.printStackTrace();
    if (fileArray != null) {
    for (int i=0; i<fileArray.length; i++) {
    System.out.println(
    "fileArray[" + i + "] = " +
    ((int)fileArray[i] < 9 ? " " : "") +
    ( ((int)fileArray[i] > 9 && (int)fileArray[i] <= 99) ? " " : "") +
    fileArray[i] + " : " +
    " HEX=(0x" + byteToHex(fileArray[i]) + ") : " +
    " charValue=(" + (char)fileArray[i] + ")");
    Having main method helps you to run the file in JDEVELOPER or using JAVA.
    DO not forget to load this class into the database.
    And you create the pl/sql wrapper again as follows:
    create or replace FUNCTION TOBY (pfilename in varchar2) RETURN VARCHAR2 iS
    language java name
    'ReadFileIntoByteArray.chk_file(java.lang.String) return byte[]';
    And you call the function from sqlplus as follows:
    Sql>Set serveroutput on size 20000;
    Sql> call dbms_java.set_output(20000);
    Sql> Select toby(“filename”) from dual; --
    this file should be accessible, I mean you will not be able to send a file on your pc, from sql plus as sql/plus is running on your db server.
    You will be able to see the output in sql plus:
    If you are running it from the APEX:
    When we use file browser widget from APEX, the file is stored in APEX_APPLICATION_FILES table. And we retrieve that into a variable and pass this variable to the function as follows:
    DECLARE
    scan_failed EXCEPTION;
    x varchar2(400);
    z number;
    BEGIN
    select filename into x from wwv_flow_files where name = :P1_FILE_NAME;
    select my1.mycheck(x,toby(x)) into z from dual;
    if z = 0 then
    :P1_SUBJECT:= 'PASSED';
    else
    :P1_SUBJECT:= 'FAILED';
    end if;
    :P1_SCAN_RESULT := '** Scanning File **';
    IF UPPER(:P1_SUBJECT) = 'PASSED' THEN
    BEGIN
    :P1_SCAN_FLAG := 'PASSED';
    :P1_SCAN_RESULT := :P1_SCAN_RESULT || ' ** File passed scan **';
    END;
    ELSIF UPPER(:P1_SUBJECT) = 'FAILED' THEN
    BEGIN
    :P1_SCAN_FLAG := 'FAILED';
    :P1_SCAN_RESULT := :P1_SCAN_RESULT || ' ** File failed scan **';
    END;
    ELSE
    BEGIN
    :P1_SCAN_FLAG := 'UNKNOWN';
    :P1_SCAN_RESULT := :P1_SCAN_RESULT || ' ** Scan Is Not Conclussive **';
    END;
    END IF;
    --IF :P1_SCAN_FLAG = 'FAILED'
    -- THEN RAISE scan_failed;
    --END IF;
    EXCEPTION
    WHEN OTHERS THEN
    DELETE from APEX_APPLICATION_FILES WHERE name = :P1_FILE_NAME;
    RAISE_APPLICATION_ERROR (-20000, 'seb OTHERS error encountered - file upload not allowed. Possible virus detected !');
    raise;
    END;
    ACKNOWLEDMENTS:
    1) JOHN SCOTT – who suggested this ICAP API in one of the threads which is my initial starting point in this direction.
    2) VLAD KOFMAN who wrote the article on WWW.DEVELOPER.com
    3) Mr. KIRAN –One of the engineers from Metalink, who helped me at every step of getting this java programs and pl/sql wrappers working. But for him, I would have not completed my project.

  • Problems uploading files to various web browsers

    I'm having huge problems with uploading files to various browsers on my MacBook Pro (running Mac Lion OS X 10.7.5)
    My default web browser is Google Chrome but I have tried Firefox, Safari and Mail, too, and they're all presenting the same problem.
    The problem is that whenever I try to attach a document to an email in Gmail or upload a photo/file to any website - it just doesn't play ball. The web browser then becomes totally unresponsive (not loading new tabs etc.) and I have to Force Quit and start the application running again. When I tried this in Mail, the application actually crashed.
    I've figured out a way to get round the problem in Gmail - creating documents in Google Drive or simply dragging documents into the email - but I'm starting an online course soon and I really need to be able to upload documents, files, images etc.
    So far I have tried:
    Updating the software on my Mac
    Updating Google Chrome
    Uninstalling and reinstalling Google Chrome
    Signing in and out of Google Chrome
    Deleting all browser history on Google Chrome
    I've also figured out that it's not my firewall as I had an unrelated problem with that and it was taken down for around 24 hours to be fixed - I tried again to upload files in this 24 hour window and encountered the same problems.
    I'm also having problems with my Windows for Mac - whenever I try to Save or Save As in Word - the programme becomes completely unresponsive, parts of the toolbars at the top white out and I have to Force Quit - hence, why I started using Google Drive to create documents. When I try and Save or Save As in Excel or Powerpoint, these programmes crash too.
    I don't know if these problems are related, but I thought it best to bring it up just in case.
    Can anyone help me?!

    In answer to my own question, in case anyone has the same issue, the problem turned out to be that my hard drive is failing.
    If anyone has the same problem, back up all your data to an external device immediately (trying to run a computer on a failing hard drive is like trying to run on a broken leg, so I'm told) and take your mac to get a new hard drive - should cost around £100.

  • Photo upload file permissions?

    Hi,
    My website will give users the option to upload photographs which will be displayed on the website.
    Before a user can do this they must register or be logged in to their account.
    I will be using a shared hosting environment.
    My script does check the file size and type and only allows .jpg .gifs and .png.
    I need to set global permissions, is there a way of defining a registered user as the owner so that I only need apply owner permissions of 700 rather than setting at 777?
    My other concern is that the files that I upload the photos to is also the one that I link to from my web pages to display the images, should I be copying the uploaded images to another file then linking to that one to display the images?
    Hope I am making sense.
    Thank you in advance for your help and information.

    Hi Rob,
    Just to clarify your helpful comments, there are two comments that I am not fully understanding.
    Firstly yes I am allowing registered users to upload through http protocol.
    And yes the files that are being uploaded to will be under website ownership.
    As it will be shared apache hosting I need to set read write and execute permissions to allow the upload script to perform, which I have to do using chmod and assigning restrictive permissions if possible.
    Your comment: As long as the scripts performing the uploads are within the SAME ACCOUNT....
    The script is just there within the page, a user registers their details and then is allow to go to the page that upload information to the database and photos to the upload script, returning users, after log in is verified, are also allowed on the page that upload photos, DOES THAT MEAN THEY ARE WITHIN THE SAME ACCOUNT AS WEBSITE OWNER?
    Your comment:  Why do you feel you need to assign apache permissions to INDIVIDUAL USERS?
    I wanted to apply permission the the upload files but I thought the 'status' of my users would be like 'general public' I guess that ties in with the last comment about account ownership, for what ever reason I was thinking that a user, even if registered, would be just like a a public person and for them to be able to use the upload scripts I thought that I would need to somehow tell the files that this person was the 'owner' so that I could apply 700 permissions to the actual file rather than 777 permissions, I was trying to find a way to use a more restrictive permission level ( sorry if I didn't explain it well).
    So I am getting this right, I do hope so! A user on my website who is using the upload scripts has ownership permissions, so if I set the permissions on my upload file to 700, it will allow read, write and execute permission for the file and I don't need to set the status of my users to 'owner' they just will be as such the 'owner' because they are using the script?
    Thank you for your time a patience, I look forward to your reply and hopefully confirmation that i am now understanding this correctly.
    Best regards 
    Date: Sat, 17 Nov 2012 20:58:59 -0700
    From: [email protected]
    To: [email deleted]
    Subject: Re: photo upload file permissions? photo upload file permissions?
        Re: photo upload file permissions?
        created by Rob Hecker2 in Developing server-side applications in Dreamweaver - View the full discussion
    is there a way of defining a registered user as the owner so that I only need apply owner permissions of 700 rather than setting at 777?If users are uploading through the HTTP protocol, then the owner of the folders and files is going to be set to the website ownership.All files and folders will share the same ownership. As long as the scripts performing the uploads are within the same account, there should not be an issue, and you should be able to assign more restrictive permissions than 777. Why do you feel you need to assign apache permissions to individual users? (which you can't do anyway, using http)  It would be pretty easy using sessions and PHP  to keep user files separate from each other in unique folders. But if users will use the FTP protocol, the situation would be very different.
    Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at http://forums.adobe.com/message/4855936#4855936
    Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page: Re: photo upload file permissions?
    To unsubscribe from this thread, please visit the message page at Re: photo upload file permissions?. In the Actions box on the right, click the Stop Email Notifications link.
    Start a new discussion in Developing server-side applications in Dreamweaver by email or at Adobe Community
      For more information about maintaining your forum email notifications please go to http://forums.adobe.com/message/2936746#2936746.

  • Adobe Muse won't publish (Error uploading file)

    After making simple animations using Adobe Edge Animate it seems as though none of the assets will publish with my site after importing them into Muse.
    In Edge animate I saved for "web animation" and published. Then I went to muse and hit "place". I went to preview and everything works fine. When I go to publish there are always errors in uploading my assets with '.png' extensions.
    Any help is much appreciated. I have completely scrapped my website and created another, reinstalled Animate and have renamed all my files, I'm not sure whats wrong here.
    I got one animation working, and that can be seen here under the Photography section, but I have multiples that will be shown on my page at one time.
    http://chasebodydesign.businesscatalyst.com

    I get the error uploading file everytime I try publishing the animation.

  • Is there a way to silently upload files?

    Ok, so I've taken the plunge. I've started working on an AIR
    app using Flash CS3. I'm putting together a little app that will
    keep my online store updated with all the product updates from our
    wholesaler. This includes parsing a csv file, downloading product
    images from the wholesaler, updating the database, and then
    uploading the images to our server.
    The problem is that AIR does not seem to have the
    functionality to silently upload files! Sure, I can use the
    file.reference object to fire off the browse method, which then
    opens the OS file browser window BUT I would really like the whole
    thing to be hands off. In the past, I've written these types of
    apps using Visual Studio but I haven't touched VS in two years.
    Has anyone run across a way to silently upload or ftp files
    in AIR?

    Hey Oliver,
    Thanks for your answer--the fact that it CAN be done has
    gotten me a lot further on finding a solution. Here's what I have
    so far. As it runs, I can see the progress and completion of the
    upload but I'm still not getting it saved. I'm uploading it to a
    ColdFusion processing page.
    AS3 Code:
    import flash.filesystem.*;
    import flash.net.URLRequest;
    //Silent File Upload (no browse window)
    function imageUpload(imageName,uploadPage):void
    trace('Starting Upload of ' + imageName + '\n');
    var myFile:File =
    File.applicationDirectory.resolvePath(imageName);
    var request:URLRequest = new URLRequest(uploadPage);
    request.method = URLRequestMethod.POST;
    myFile.addEventListener(ProgressEvent.PROGRESS,progressHandler);
    myFile.addEventListener(Event.COMPLETE,completeHandler);
    myFile.upload(request,"theFile");
    function progressHandler(event:ProgressEvent):void {
    var file:FileReference = FileReference(event.target);
    var pLoaded =
    Math.ceil(event.bytesLoaded/event.bytesTotal*100);
    trace(pLoaded + '% uploaded');
    function completeHandler(event:Event):void
    trace ('Upload complete.');
    var uploadPage = "
    http://www.aaronbday.com/upload_file.cfm";
    imageUpload("angelic_cat.jpg",uploadPage);
    Here's the CFM page:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
    Transitional//EN" "
    http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="
    http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html;
    charset=utf-8" />
    <title>Upload File</title>
    </head>
    <body>
    <cfif isDefined("form.theFile")>
    <!---we only want images--->
    <cffile
    action="upload"
    destination="#ExpandPath("test/")#"
    filefield="theFile"
    nameconflict="overwrite"
    accept="image/jpg,image/jpeg,image/gif,image/pjpeg"
    >
    <cfoutput><img src="test/#cffile.serverFile#"
    /></cfoutput>
    <cfelse>
    <form method="post" action="upload_file.cfm"
    enctype="multipart/form-data">
    <input type="file" name="theFile" />
    <input type="submit" name="Submit" />
    </form>
    </cfif>
    </body>
    </html>
    Any ideas? Thanks!

  • Using ABAP Webdynpr How to Upload File and download file in SAP R/3

    Hi SAP GURUS ,
                             I wanted to save employee profile from ESS to SAP so i am creating ESS Application .
    For that I go with BDS Approach and create test program for this  I got success while uploading file in my folder
    which i have created with the help of class and content repository . but when i Using ABAP Webdynpro , i got error FM "BDS_BUSINESSDOCUMENT_CREATEF"  message " error_kpro " .
                           Also I wanted to use KM for storage of Documents and wanted to retrive with help of ABAP Webdynpro .
                           So pls tell me / mailed me the process , approach and if you have examples .
        Thanks in Advance ,
         Vishwassap at gmail

    Hi Vishwas,
    Check out the thread [Efficient way of saving documents uploaded|Re: Efficient way of saving documents uploaded by users; and check the blog by Raja Thangamani.
    Also check the thread [Export Images through Function Modules   |Export Images through Function Modules;.
    Hope it helps you.

  • Itunes Producer Problems Uploading - File not saving - file does not Exist.

    Can someone please help me out, this problem is killing me. I've uploaded over 200 UPC Albums using Old G3 and Elderly ITunes Producer, but apple asked me to upgrade, so new machine to me Macmini maverics 10.9.? ITunes Producer 3.1.
    So I click open ITunes producer 3.1. Click on make project from Audio
    Files. Name and Save the project in Music-ITunes Producer-Playlists.
    Plug in my external Flash drive and import the 40 Audio files for the
    project. I am using an external flash drive as I can’t get ITunes Producer to
    see my internal hard disk, I do not know if this is normal??
    Go through the process of saving the project to Music – ITunes Producer –
    Playlists – in this case 5060101121313
    I then go through name all Tracks and make sure that all Data is correct.
    Then when I finally go to either save the document or send it to you I get the
    first Screen shot saying
    "The Document "5060101121313" COULD NOT BE SAVED. The File does not exist".
    As I say I have delivered 200 UPC’s to you with the old software and never
    had any problems, I am in urgent need of making significant delivery to you so
    would appreciate you help ASAP.
    Paul

    I have been victorious. Now I am going to post my solution for all those that may have the same problem in the future. I'll even throw in a few key words so it will be more easily found by the search engine.
    Connection conn = null;
            try{
                //connect to database
                DAOManager dao = new DAOManager();
                conn = dao.connectToDB();
                String query = "update ASSIGNMENT set file_object = ?, filename = ?, filetype = ? where a_key = 1"; //sql query
                PreparedStatement pstmt = conn.prepareStatement(query);
                ByteArrayOutputStream baostream = new ByteArrayOutputStream();
                //write to output stream
                byte[] buffer = new byte[1024];
                int len = -1;
                while ((len = instream.read(buffer)) >= 0 )
                    baostream.write(buffer, 0, len);
                baostream.flush();
                byte[] filebytes = baostream.toByteArray();
                baostream.close();
                pstmt.setBytes(1,filebytes); //set blob
                pstmt.setString(2,filename);
                pstmt.setString(3,filetype);
                pstmt.executeUpdate();
                pstmt.close();
            catch (SQLException e) {
                System.out.println(Tools.getLoggingDate() + " upload() Error uploading file -- " + e);
                e.printStackTrace();
            catch (Exception e) {
                System.out.println(Tools.getLoggingDate() + " upload() Error: " + e);
            finally {
                try{
                    conn.close();
                }catch (SQLException e) {}
            }Keywords: setBinaryStream(), setBytes(), MySQL, upload file, InputStream, Blob

  • We can use JSR-168 JPS portlet upload file,

    We can use JSR-168 JPS portlet upload file,
    here is the source for you referrence:
    upload file can use JSR168 portlet,
    1,CustomizablePortlet.java File
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.util.ResourceBundle;
    import javax.portlet.*;
    import oracle.webdb.utils.SimpleStringBuffer;
    public class CustomizablePortlet extends GenericPortlet {
    private static final String TITLE_KEY = "title";
    protected static final String OK_ACTION = "ok_action";
    protected static final String APPLY_ACTION = "apply_action";
    protected static final PortletMode PREVIEW_MODE = new PortletMode("preview");
    protected static final PortletMode EDIT_DEFAULTS_MODE = new PortletMode("EDIT_DEFAULTS");
    protected static final PortletMode ABOUT_MODE = new PortletMode("ABOUT");
    public CustomizablePortlet() {
    public String getTitle(RenderRequest request) {
    return request.getPreferences().getValue("title", getPortletConfig().getResourceBundle(request.getLocale()).getString("javax.portlet.title"));
    public void doEdit(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.print("<FORM ACTION=\"");
    out.print(getEditFormSubmitURL(request, response));
    out.println("\" METHOD=\"POST\">");
    out.println("<TABLE BORDER=\"0\">");
    out.println("<TR>");
    out.println("<TD WIDTH=\"20%\">");
    out.println("<P CLASS=\"portlet-form-field\" ALIGN=\"RIGHT\">Title:");
    out.println("</TD>");
    out.println("<TD WIDTH=\"80%\">");
    out.print("<INPUT CLASS=\"portlet-form-input-field\" TYPE=\"TEXT\" NAME=\"");
    out.print("title");
    out.print("\" VALUE=\"");
    out.print(getTitle(request));
    out.println("\" SIZE=\"20\">");
    out.println("</TD>");
    out.println("</TR>");
    out.println("<TR>");
    out.println("<TD COLSPAN=\"2\" ALIGN=\"CENTER\">");
    out.print("<INPUT CLASS=\"portlet-form-button\" TYPE=\"SUBMIT\" NAME=\"");
    out.print("ok_action");
    out.print("\" VALUE=\"OK\">");
    out.print("<INPUT CLASS=\"portlet-form-button\" TYPE=\"SUBMIT\" NAME=\"");
    out.print("apply_action");
    out.print("\" VALUE=\"Apply\">");
    out.println("</TD>");
    out.println("</TR>");
    out.println("</TABLE>");
    out.println("</FORM>");
    protected String getEditFormSubmitURL(RenderRequest request, RenderResponse response) {
    return response.createActionURL().toString();
    public void doHelp(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.print("Help for <i><b>");
    out.print(getTitle(request));
    out.println("</b></i>.");
    public void doAbout(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    String aboutHTML = (new SimpleStringBuffer(30)).append("/about_").append(getPortletName()).append(".html").toString();
    PortletRequestDispatcher rd = getPortletContext().getRequestDispatcher(aboutHTML);
    response.setContentType("text/html");
    if(rd != null) {
    rd.include(request, response);
    } else {
    PrintWriter out = response.getWriter();
    out.print("<p class=\"portlet-font\">This is the about page for ");
    out.print(getTitle(request));
    out.print(".</p><p class=\"portlet-font\">");
    out.print("To customize the contents of this page, create a file named '");
    out.print(aboutHTML.substring(1));
    out.print("' in the Portlet web application's root directory containing HTML ");
    out.print("to appear here. ");
    out.print("Alternatively, override the <code>CustomizablePortlet</code> ");
    out.println("class's <code>doAbout()</code> method.</p>");
    public void doDispatch(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    WindowState state = request.getWindowState();
    if(!state.equals(WindowState.MINIMIZED)) {
    PortletMode mode = request.getPortletMode();
    if(mode.equals(PREVIEW_MODE))
    doView(request, response);
    else
    if(mode.equals(EDIT_DEFAULTS_MODE))
    doEdit(request, response);
    else
    if(mode.equals(ABOUT_MODE))
    doAbout(request, response);
    else
    super.doDispatch(request, response);
    } else {
    super.doDispatch(request, response);
    public void processAction(ActionRequest request, ActionResponse actionResponse) throws PortletException, IOException {
    String newTitle = request.getParameter("title");
    PortletPreferences prefs = request.getPreferences();
    prefs.setValue("title", newTitle);
    prefs.store();
    if(request.getParameter("ok_action") != null) {
    actionResponse.setPortletMode(PortletMode.VIEW);
    actionResponse.setWindowState(WindowState.NORMAL);
    2,FileUploadPortlet.java file
    import java.io.*;
    import javax.activation.DataHandler;
    import javax.mail.MessagingException;
    import javax.mail.internet.MimeBodyPart;
    import javax.portlet.*;
    import oracle.portal.portlet.sample.CustomizablePortlet;
    public class FileUploadPortlet extends CustomizablePortlet
    private static final String FILE_PARAM = "file";
    private static final String SUBMIT_PARAM = "submit";
    private static final String DEFAULT_CHARSET = "ISO-8859-1";
    private static final String uploadRoot = "";
    public FileUploadPortlet()
    public void doView(RenderRequest request, RenderResponse response) throws PortletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.print("<form action=\"");
    out.print(response.createActionURL().toString());
    out.println("\" enctype=\"multipart/form-data\" method=\"post\">");
    out.println("<center><table border=\"0\">");
    out.println("<tr>");
    out.print("<td class=\"portlet-form-field\" align=\"right\">");
    out.print("Please browse to an HTML file:");
    out.println("</td>");
    out.print("<td>");
    out.print("<input class=\"portlet-form-input-field\" type=\"file\" name=\"");
    out.print("file");
    out.print("\">");
    out.println("</td>");
    out.println("</tr>");
    out.println("<tr>");
    out.println("<td colspan=\"2\" align=\"center\">");
    out.print("<input type=\"submit\" class=\"portlet-form-button\" name=\"");
    out.print("submit");
    out.print("\" value=\"Display\">");
    out.println("</td>");
    out.println("</tr>");
    out.println("</table>");
    out.println("</form>");
    String lastFile = request.getPreferences().getValue("file", null);
    if(lastFile != null) {
    out.println("<hr width=\"100%\"><br>");
    out.print(lastFile);
    public void processAction(ActionRequest request, ActionResponse actionResponse) throws PortletException, IOException {
    FormDataParser parsedRequest = new FormDataParser(request);
    MimeBodyPart mbp = parsedRequest.getMimeBodyPart("file");
    if(mbp == null)
    super.processAction(request, actionResponse);
    else
    try {
    String fileName= mbp.getFileName();
    int splash = fileName.lastIndexOf("\\");
    if(splash != -1)
    fileName = fileName.substring(splash +1, fileName.length()).trim();
    String contentType = mbp.getContentType();
    String charSet = getCharsetFromContentType(contentType);
    int sepIndex = contentType.indexOf(';');
    if(sepIndex != -1)
    contentType = contentType.substring(0, sepIndex).trim();
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    mbp.getDataHandler().writeTo(bos);
    bos.close();
    String content = new String(bos.toByteArray(), charSet);
    FileOutputStream fos = new FileOutputStream(fileName);
    fos.write(bos.toByteArray());
    fos.close();
    PortletPreferences prefs = request.getPreferences();
    prefs.setValue("file", fileName + "upload ok");
    prefs.store();
    catch(MessagingException me) {
    throw new PortletException(me);
    public static String getCharsetFromContentType(String contentType) {
    int lastPos;
    if((lastPos = contentType.indexOf(';')) == -1)
    return "ISO-8859-1";
    lastPos++;
    String lowerContentType = contentType.toLowerCase();
    int nextPos;
    do {
    nextPos = lowerContentType.indexOf(';', lastPos);
    String param;
    if(nextPos == -1)
    param = lowerContentType.substring(lastPos).trim();
    else
    param = lowerContentType.substring(lastPos, nextPos).trim();
    if(param.startsWith("charset=") && param.length() > 8)
    return param.substring(8);
    lastPos = nextPos + 1;
    } while(nextPos != -1);
    return "ISO-8859-1";
    3,FormDataParser.java file
    import java.io.*;
    import java.util.*;
    import javax.activation.DataSource;
    import javax.mail.MessagingException;
    import javax.mail.internet.MimeBodyPart;
    import javax.mail.internet.MimeMultipart;
    import javax.portlet.ActionRequest;
    import javax.portlet.PortletException;
    public class FormDataParser {
    private static final String MULTIPART_PREFIX = "multipart/";
    private static final String MULTIPART_FORM_DATA = "multipart/form-data";
    private static final String PLAIN_TEXT = "text/plain";
    private ActionRequest mWrappedRequest;
    private Map mParams;
    private Map mBodyParts;
    private boolean mIsInitialized;
    private boolean mHasMultipart;
    public FormDataParser(ActionRequest request) {
    mWrappedRequest = request;
    public String getParameter(String name) throws PortletException {
    String value = mWrappedRequest.getParameter(name);
    if(value != null)
    return value;
    initParameters();
    if(!mHasMultipart)
    return null;
    List paramList = (List)mParams.get(name);
    if(paramList != null)
    return (String)paramList.get(0);
    else
    return null;
    public String[] getParameterValues(String name) throws PortletException {
    String values[] = mWrappedRequest.getParameterValues(name);
    if(!mHasMultipart)
    return values;
    initParameters();
    List valueList = (List)mParams.get(name);
    if(valueList == null)
    return values;
    int size = valueList.size();
    if(values != null) {
    List newValueList = new ArrayList(values.length + size);
    newValueList.addAll(Arrays.asList(values));
    newValueList.addAll(valueList);
    valueList = newValueList;
    values = new String[size];
    valueList.toArray(values);
    return values;
    public MimeBodyPart getMimeBodyPart(String name) throws PortletException {
    initParameters();
    if(!mHasMultipart) {
    return null;
    } else {
    List parts = (List)mBodyParts.get(name);
    return parts != null ? (MimeBodyPart)parts.get(0) : null;
    public MimeBodyPart[] getMimeBodyParts(String name) throws PortletException {
    initParameters();
    if(!mHasMultipart)
    return null;
    List parts = (List)mBodyParts.get(name);
    if(parts == null) {
    return null;
    } else {
    MimeBodyPart mimeBodyParts[] = new MimeBodyPart[parts.size()];
    parts.toArray(mimeBodyParts);
    return mimeBodyParts;
    private void initParameters() throws PortletException {
    if(mIsInitialized)
    return;
    String contentType = mWrappedRequest.getContentType();
    if(contentType == null) {
    mIsInitialized = true;
    return;
    int sepIndex = contentType.indexOf(';');
    if(sepIndex != -1)
    contentType = contentType.substring(0, sepIndex).trim();
    if(contentType.equalsIgnoreCase("multipart/form-data")) {
    mParams = new HashMap(20);
    mBodyParts = new HashMap(20);
    DataSource ds = new DataSource() {
    public InputStream getInputStream() throws IOException {
    return mWrappedRequest.getPortletInputStream();
    public OutputStream getOutputStream() throws IOException {
    throw new IOException("OutputStream not available");
    public String getContentType() {
    return mWrappedRequest.getContentType();
    public String getName() {
    return getClass().getName();
    try {
    MimeMultipart multipartMessage = new MimeMultipart(ds);
    parseMultiPart(multipartMessage, null);
    catch(MessagingException me) {
    throw new PortletException(me);
    catch(IOException ioe) {
    throw new PortletException(ioe);
    mHasMultipart = true;
    mIsInitialized = true;
    private void parseMultiPart(MimeMultipart multipartMessage, String parentFieldName) throws MessagingException, IOException {
    int partCount = multipartMessage.getCount();
    for(int i = 0; i < partCount; i++) {
    javax.mail.BodyPart part = multipartMessage.getBodyPart(i);
    if(part instanceof MimeBodyPart) {
    MimeBodyPart mimePart = (MimeBodyPart)part;
    String disps[] = mimePart.getHeader("Content-Disposition");
    if(disps != null && disps.length != 0) {
    String disp = disps[0];
    String lcDisp = disp.toLowerCase();
    int nameStart;
    int nameEnd;
    if((nameStart = lcDisp.indexOf("name=\"")) != -1 && (nameEnd = lcDisp.indexOf("\"", nameStart + 6)) != -1)
    parentFieldName = disp.substring(nameStart + 6, nameEnd);
    if(parentFieldName != null)
    if(mimePart.getContentType().toLowerCase().startsWith("multipart/")) {
    Object content = mimePart.getContent();
    if(content instanceof MimeMultipart)
    parseMultiPart((MimeMultipart)content, parentFieldName);
    } else
    if((nameStart = lcDisp.indexOf("filename=\"")) != -1 && (nameEnd = lcDisp.indexOf("\"", nameStart + 10)) != -1) {
    List values = (List)mBodyParts.get(parentFieldName);
    if(values == null) {
    values = new ArrayList(1);
    mBodyParts.put(parentFieldName, values);
    values.add(mimePart);
    } else
    if(mimePart.getContentType().toLowerCase().startsWith("text/plain")) {
    Object content = mimePart.getContent();
    if(content instanceof String) {
    List values = (List)mParams.get(parentFieldName);
    if(values == null) {
    values = new ArrayList(1);
    mParams.put(parentFieldName, values);
    values.add((String)content);
    4.web.xml file
    <?xml version = '1.0' encoding = 'ISO-8859-1'?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <display-name>hanhuiwen OracleSamplePortlets</display-name>
    <description>hanhuiwen Oracle Sample Portlet Application</description>
    <servlet>
    <servlet-name>portletdeploy</servlet-name>
    <servlet-class>oracle.webdb.wsrp.server.deploy.PortletDeployServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>portletjaxrpc</servlet-name>
    <servlet-class>com.sun.xml.rpc.server.http.JAXRPCServlet</servlet-class>
    <init-param>
    <param-name>configuration.file</param-name>
    <param-value>/WEB-INF/WSRPService_Config.properties</param-value>
    </init-param>
    </servlet>
    <servlet>
    <servlet-name>portletresource</servlet-name>
    <servlet-class>oracle.webdb.wsrp.server.ResourceServlet</servlet-class>
    </servlet>
    <servlet>
    <servlet-name>ChartServlet</servlet-name>
    <display-name>Chart Servlet</display-name>
    <description>Demo image-generating servlet</description>
    <servlet-class>oracle.portal.portlet.sample.chart.ChartServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet>
    <servlet-name>uix</servlet-name>
    <servlet-class>oracle.cabo.servlet.UIXServlet</servlet-class>
    <init-param>
    <param-name>oracle.cabo.servlet.pageBroker</param-name>
    <param-value>oracle.cabo.servlet.xml.UIXPageBroker</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>ChartServlet</servlet-name>
    <url-pattern>/chart*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>portletjaxrpc</servlet-name>
    <url-pattern>/portlets*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>portletresource</servlet-name>
    <url-pattern>/portletresource*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>uix</servlet-name>
    <url-pattern>*.uix</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
    <servlet-name>uix</servlet-name>
    <url-pattern>/uix/*</url-pattern>
    </servlet-mapping>
    <session-config>
    <session-timeout>60</session-timeout>
    </session-config>
    <welcome-file-list>
    <welcome-file>index.uix</welcome-file>
    </welcome-file-list>
    <!--
    LogLevel controls the amount of information logged. There are 7 log levels:
    0 - logging disabled
    1 - configuration
    2 - severe error
    3 - warning
    4 - throwing exception
    5 - performance
    6 - information
    7 - debug
    The oracle.portal.log.Logger interface defines methods that map to these 7
    log levels. However, there are also 2 methods that do not map to log
    levels. These methods are included for backwards compatibility and data
    logged using these methods will always be logged regardless of the log level.
    -->
    <env-entry>
    <env-entry-name>oracle/portal/log/logLevel</env-entry-name>
    <env-entry-type>java.lang.Integer</env-entry-type>
    <env-entry-value>7</env-entry-value>
    </env-entry>
    </web-app>
    5.portlet.xml
    <?xml version = '1.0' encoding = 'UTF-8'?>
    <portlet-app xmlns="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd" version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd http://java.sun.com/xml/ns/portlet/portlet-app_1_0.xsd">
    <portlet>
    <description xml:lang="en">A portlet that demonstrates the file upload features of the Java Portlet Specification.</description>
    <portlet-name>FileUpload</portlet-name>
    <portlet-class>FileUploadPortlet</portlet-class>
    <expiration-cache>0</expiration-cache>
    <supports>
    <mime-type>text/html</mime-type>
    <portlet-mode>help</portlet-mode>
    <portlet-mode>about</portlet-mode>
    <portlet-mode>edit_defaults</portlet-mode>
    </supports>
    <supported-locale>en</supported-locale>
    <portlet-info>
    <title>File Upload Portlet</title>
    <short-title>File Upload</short-title>
    <keywords>File,Upload, Portlet</keywords>
    </portlet-info>
    </portlet>
    <custom-portlet-mode>
    <description xml:lang="en">This mode should be used by the portlet to display information on the portlet's purpose, origin, version, etc.</description>
    <portlet-mode>about</portlet-mode>
    </custom-portlet-mode>
    <custom-portlet-mode>
    <description xml:lang="en">This mode signifies that the portlet should render a screen to set the default values for the modifiable preferences that are typically changed in the EDIT screen. Calling this mode requires that the user must have administrator rights.</description>
    <portlet-mode>edit_defaults</portlet-mode>
    </custom-portlet-mode>
    <custom-portlet-mode>
    <description xml:lang="en">This mode should be used by the portlet to render output without the need of having back-end connections or user specific data available.</description>
    <portlet-mode>preview</portlet-mode>
    </custom-portlet-mode>
    <user-attribute>
    <name>user.name.given</name>
    </user-attribute>
    <user-attribute>
    <name>user.name.family</name>
    </user-attribute>
    <user-attribute>
    <name>user.name.middle</name>
    </user-attribute>
    <user-attribute>
    <name>user.name.nickname</name>
    </user-attribute>
    <user-attribute>
    <name>user.bdate</name>
    </user-attribute>
    <user-attribute>
    <name>user.business-info.online.email</name>
    </user-attribute>
    </portlet-app>

    Hello i had exactly the same error, but not with file upload.
    I'm sure you have in your application lib directory to jars which aren't compatible to each other.
    And the problem occured between my myfaces and tomahawk jars .
    See this page:
    http://wiki.apache.org/myfaces/CompatibilityMatrix
    It tells you which myfaces and tomahawk jars you can use together.
    Hope it can help.
    bye

Maybe you are looking for

  • Pass a particular value  in the function module.

    Hi Gurus! I have a function module READ_HAUPTBUCH_TEXT , here in the importing table KONTENPLAN like ska1-ktopl. But I need to pass a value as ZNOA for KONTENPLAN while calling the function which is maintained in the db, but it is always picking up t

  • Error while trying to synchronize Audio

    Dear Garageband Gurus, I stand in need of your expertise. Specs: Garageband Version 10.0.3 Apple Specs: Here's context of my problem first: During a live seminar, I am recording three tracks in Garageband, they are connected to an audio/usb MIDI devi

  • Dynamic xml pdf form, but actions not allowed

    I have built a form and would like to make the users aware that some fields are compulsory. With the validation I only see American options for postcode or telephone. When I create my own example it is not accepted (disappears). Actions can't be adde

  • How to create a 'System'variable to identify the system from merged dimension

    Hi,      I have a webi report with merged dimensions on users and roles. Users and Roles are coming from 3 different systems (ECC,BW,BOBJ). Now, I don't have the system field available in the queries to filter by the system. So, I would like to creat

  • Security with WLST

    Satya, it always creates with a name "Realm", does not matter what name you give.