Flex file upload issue with large image files

     Hello, I have created a sample flex application to upload an image and also created java servlet to upload and save image and deployed in local tomcat server. I am testing the application in LAN. I am able to upload small as well as large image file(1Mb) from some PCs but in some other PCs I am getting IOError while uploading large image files however it is working fine for small images. Image uploading is hanging after 10%-20% and throwing IOError. *Surprizgly it is working Ok with XP systems and causeing issues with Windows7 systems*.
Plz give me any idea to get a solution.
In Tomcat server side it is giving following error:
request: org.apache.catalina.connector.RequestFacade@c19694
org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. Stream ended unexpectedly
        at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:371)
        at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.ja va:126)
        at flex.servlets.UploadImage.doPost(UploadImage.java:47)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:290)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
        at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)
        at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProto col.java:594)
        at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)
        at java.lang.Thread.run(Thread.java:722)
Caused by: org.apache.commons.fileupload.MultipartStream$MalformedStreamException: Stream ended unexpectedly
        at org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStre am.java:982)
        at org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:8 86)
        at java.io.InputStream.read(InputStream.java:101)
        at org.apache.commons.fileupload.util.Streams.copy(Streams.java:96)
        at org.apache.commons.fileupload.util.Streams.copy(Streams.java:66)
        at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:366)
UploadImage.java:
package flex.servlets;
import java.io.*;
import java.sql.*;
import java.util.*;
import java.text.*;
import java.util.regex.*;
import org.apache.commons.fileupload.servlet.ServletFileUpload;
import org.apache.commons.fileupload.disk.DiskFileItemFactory;
import org.apache.commons.fileupload.*;
import sun.reflect.ReflectionFactory.GetReflectionFactoryAction;
import javax.servlet.*;
import javax.servlet.http.*;
public class UploadImage extends HttpServlet{
         * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
         *      response)
        protected void doGet(HttpServletRequest request,
                        HttpServletResponse response) throws ServletException, IOException {
                // TODO Auto-generated method stub
                doPost(request, response);
        public void doPost(HttpServletRequest request,
                        HttpServletResponse response)
        throws ServletException, IOException {
                PrintWriter out = response.getWriter();
                boolean isMultipart = ServletFileUpload.isMultipartContent(
                                request);
                System.out.println("request: "+request);
                if (!isMultipart) {
                        System.out.println("File Not Uploaded");
                } else {
                        FileItemFactory factory = new DiskFileItemFactory();
                        ServletFileUpload upload = new ServletFileUpload(factory);
                        List items = null;
                        try {
                                items = upload.parseRequest(request);
                                System.out.println("items: "+items);
                        } catch (FileUploadException e) {
                                e.printStackTrace();
                        Iterator itr = items.iterator();
                        while (itr.hasNext()) {
                                FileItem item = (FileItem) itr.next();
                                if (item.isFormField()){
                                        String name = item.getFieldName();
                                        System.out.println("name: "+name);
                                        String value = item.getString();
                                        System.out.println("value: "+value);
                                } else {
                                        try {
                                                String itemName = item.getName();
                                                Random generator = new Random();
                                                int r = Math.abs(generator.nextInt());
                                                String reg = "[.*]";
                                                String replacingtext = "";
                                                System.out.println("Text before replacing is:-" +
                                                                itemName);
                                                Pattern pattern = Pattern.compile(reg);
                                                Matcher matcher = pattern.matcher(itemName);
                                                StringBuffer buffer = new StringBuffer();
                                                while (matcher.find()) {
                                                        matcher.appendReplacement(buffer, replacingtext);
                                                int IndexOf = itemName.indexOf(".");
                                                String domainName = itemName.substring(IndexOf);
                                                System.out.println("domainName: "+domainName);
                                                String finalimage = buffer.toString()+"_"+r+domainName;
                                                System.out.println("Final Image==="+finalimage);
                                                File savedFile = new File(getServletContext().getRealPath("assets/images/")+"/LowesFloorPlan.png");
                                                //File savedFile = new File("D:/apache-tomcat-6.0.35/webapps/ROOT/example/"+"\\test.jpeg");
                                                item.write(savedFile);
                                                out.println("<html>");
                                                out.println("<body>");
                                                out.println("<table><tr><td>");
                                                out.println("");
                                                out.println("</td></tr></table>");
                                                try {
                                                        out.println("image inserted successfully");
                                                        out.println("</body>");
                                                        out.println("</html>");  
                                                } catch (Exception e) {
                                                        System.out.println(e.getMessage());
                                                } finally {
                                        } catch (Exception e) {
                                                e.printStackTrace();

It is only coming in Windows 7 systems and the root of this problem is SSL certificate.
Workaround for this:
Open application in IE and click on certificate error link at address bar . Click install certificate and you are done..
happy programming.
Thanks
DevSachin

Similar Messages

  • File upload - issue with European .csv file format

    All,
    when uploading the .csv file for "Due List for Planned Receipts" in the File Transfer Upload center I receive an error.  It appears that it is due to the european .csv file format that is delimited by semicolon rather than comma. The only way I could solve this issue is to change Regional and Language options to English. However, I don't think this is a great solution as I can't ask all our suppliers to change their settings.  Has anyone come across this issue and another way of solving it?
    Thank you!
    Have a good day,
    Johanna

    Igor thank you for your suggestion. 
    I found this SAP note:
    +If you download a file, and the formatting of the CSV file is faulty, it is possible that your column separator does not match the standard settings of the SAP system. In the standard SAP system, the separator is ,.
    To ensure that the formatting is correct, set your global default for column separation in your system, so that it matches that of the SAP system you are using.+
    To do that Microsoft suggests to change the "List separator" in the Regional and Language Options Customize view. Though like you suggest that does not seem to do the trick. Am I missing something?
    However, if I change the whole setting from say German to English (UK) the .csv files are comma delimited and can be easily uploaded.  Was hoping there would be another way of solving this without need for custom development.

  • How can I force that in af inputFile,File Upload popup only show image file

    Hi
    jdev 11.1.1.5
    Is there any way to force that when click the browse button in af:inputFile ,In InputFile popup only show folder and image type file?
    Thanks

    There is no filter feature available for fileUpload. You can't force the component to only show specific files.
    Timo

  • Beachballs & Hangups with large images in CC.

    I wasn't having this issue in CS6, and then I upgraded to CC. I couldn't work with large image files on my art board. I'd always beach ball while copying an image! It was crapping out my workflow, and I have more than enough ram and processing power.
    Solution:
    Turns out the primary reason for the hang-ups was caused by the 'included SVG code' option (which doesn't exist in CS6) in the File Handling Preference. I unchecked it, and it's been smooth sailing since.
    I hope this helps someone!

    Well, your resolution in Photoshop has only some relation to the size of your document in InDesign. Perhaps CS4 has something new that CS3 doesn't, but I can't set an Indy doc to 1027 x 768 pixels; the only measurements I get are things like picas, inches, and other non-screen measurements.
    When working in Photoshop (really not my strong point), you have control over both the image size and the canvas size, right? And one of the values you're working with is going to be pixels per inch, no? I'm guessing that a Photoshop image with a size of 1024 x 768 pixels at 72 ppi (screen resolution) is what you are placing in an InDesign document, which is simply not going to display that information at 72 ppi. It'll probably display it at 300 ppi, or something similar, no?
    This just shows you my basic ignorance of Photoshop. However, even someone as PS-impaired as myself knows that you can set the image size and canvas size in Photoshop, and this will control your number of pixels per inch. If you save a PSD or a TIFF out of PS, and you have your canvas and image settings correct, then you'll get a good idea onscreen of how large your image is inside your ID document, and what your resolution will be. In fact, InDesign will merrily let you place PSDs at whatever resolution you set up in PS. So, to sum up:
    1) Your image is being placed at a print-level resolution, which is why it's so small
    2) You determine the resolution of your image in Photoshop
    3) Bob's question bears repeating: 1024 whats?

  • For the last 2 days whenever I try to upload photos from my iPhoto page to facebook I get an error message: Bad Image There was a problem with the image file.  I haven't knowingly changed any settings on iPhoto or facebook. Can anyone help, please ?

    I need help with uploading photos from iPhoto to facebook. I could do it till 2 days ago. Now any new photo I try to upload gives me an error message:
    Bad Image
    There was a problem with the image file. 
    Please help.

    Can you drag it to the Desktop?

  • How to increase performance speed of Photoshop CS6 v13.0.6 with trasformations in LARGE image files (25,000 X 50,000 pixels) on IMac3.4 GHz Intel Core i7, 16 GB memory, Mac OS 10.7.5?   Should I purchase a MacPro?

    I have hundreds of these large image files to process.  I frequently use SKEW, WARP, IMAGE ROTATION features in Photoshop.  I process the files ONE AT A TIME and have only Photoshop running on my IMac.  Most of the time I am watching SLOW progress bars to complete the transformations.
    I have allocated as much memory as I have (about 14GB) exclusively to Photoshop using the performance preferences panel.  Does anyone have a trick for speeding up the processing of these files--or is my only solution to buy a faster Mac--like the new Mac Pro?

    I have hundreds of these large image files to process.  I frequently use SKEW, WARP, IMAGE ROTATION features in Photoshop.  I process the files ONE AT A TIME and have only Photoshop running on my IMac.  Most of the time I am watching SLOW progress bars to complete the transformations.
    I have allocated as much memory as I have (about 14GB) exclusively to Photoshop using the performance preferences panel.  Does anyone have a trick for speeding up the processing of these files--or is my only solution to buy a faster Mac--like the new Mac Pro?

  • Unable to create large image file in iphoto

    I make a lot of panoramic images by stitching together overlapping images with hugin in TIFF format, then edit them in iphoto and use it to export them in jpeg format for greater versitality of use. So far I haven't had any trouble, even with large images as big as ~25,000x2000 pixels and ~90MB file size.
    However, I have come across a problem recently trying to export an edited version of a particularly large one - 38,062x1799 136MB file size. I can export an unedited version to jpeg without trouble, but when I tried to export an edited version it gave me an error saying it couldn't create the file. I looked around here for solutions and found the suggestion to check the file size in finder, it was zero. After experimenting I've found that the file size goes to zero as soon as any changes are made to the file, the edited image can still be viewed in iphoto, but does not display if you try to zoom in. I have tried making the TIFF file again with hugin to see if it is a problem with the file, but I also experience the same problem with the newly made file.
    I am working on a Macbook air (1.7 GHz Intel Core i5, 4 GB 1333 MHz DDR3 Memory, Intel HD Graphics 3000 384 MB, Version 10.7.5 OS X) in iphoto '11 version 9.2.2 (629.40). Any suggestions for getting round this issue?

    I thought of something that might help with working out what's going on.
    After I make any edits to the image, if I move on to the info tab the image initially goes a bit blurry as it often does with large images, but instead of coming up as a clear image after a few seconds like normal, I get the image I've attached here and the file size changes to zero. To be able to see the thumbnail of the edited image I need to come back out to the library again, but the file size is still zero. If I revert to original the file size is restored.

  • Labview crashes when creating large image files

    I have a problem with Labview 6.0.2( I've tested evaluation version 7.0 too).
    I'm constructing a very large image, for example: 4500x4500 pixels. Labview crashes when converting the pixture to a pixmap. The image is fully constructed on my screen (in a picture control), but when converting it to a pixmap (for saving the image in a known format (bmp, jpg, tiff)), Labview crashes.
    I did some testing and when the number of pixels exceeded the limit of 2^24(16777216), the file 'image.cpp' crashes on line 1570. The vi to convert it to a pixmap is: P'icture to pixmap.vi'
    Does someone know a workaround for this problem? Or is there a fix for it?
    Thank you!

    I've tested the 6i version of my VI in Labview 7.0 evalutation version. It raised an error but not the same error:
    d:\lvworm\src\lvsource\compatexport.cpp(37) : DAbort: Called a routine not in the compatibility LVRT table
    $Id: //labview/branches/Wormhole/dev/lvsource/compatexport.cpp#11 $
    0x004BD4CB - LabVIEW_Eval + 0
    0x0EB710D9 - lvs248 + 0
    0x094C87A0 - + 0
    So i replaced the picture VI's with the 7.0 evalutation version VI's, and it worked. It is now possible for me to construct very large image files!
    I see no attached VI to test. But i guess it is also solved in Labview 7.0
    I used this file to convert the picture to image data:
    C:\Program Files\National Instruments\LabVIEW 7.0 Evaluation\vi.lib
    \picture\pictutil.llb\Picture to Pixmap.vi
    And this file to convert image data to bmp:
    C:\Program Files\National Instruments\LabVIEW 7.0 Evaluation\vi.lib\picture\bmp.llb\Write BMP File.vi
    I guess i have to write a workaround for this problem:
    divide the picture in blocks of 4096 x 4096 and then merge the image data arrays of the bloks together.

  • Issue with length of file paths - Windows & C++ plugin

    Hello,
    I've got an issue that just popped up on my OCR plugin I've been working on that I suspect is related to the length of the filepath.
    I'm getting the following error that is being caught and logged when trying to open a file (filename changed for security purposes):
    Error Opening File: D:\aVeryLongFilePath.pdf
    Exception info: This file cannot be found.
    The entire string, including the D:\ part, is 266 characters long. I cut down the length of part of the path one by one and it was able to open and OCR the document when the length was 259 characters.
    I know there's a MAX_PATH variable in Windows and/or there's some kind of limitation for file length. Note that I can open the file in Acrobat using File->Open and run OCR on it individually using the built-in Recognize Text function, but if I try to Recognize Text for Multiple files and choose "Add Folders", the file in question doesn't show up in the list of files to be batch OCR'd (even though it is there). Interestingly, choosing "Add Files" from the Recognize Text->In Multiple Files does work. So Acrobat itself has at least some issues opening the file using some of it's features.
    Here's how I'm opening the document:
         string pn;               // assume this is initialized, I'm just putting this here to demonstrate what type it is
         pathName = pn;
         ASAtom pathType = ASAtomFromString("Cstring");
         asPathName = ASFileSysCreatePathName(ASGetDefaultFileSys(), pathType, pn.c_str(), NULL);    
         pdDoc = PDDocOpen(asPathName, ASGetDefaultFileSys(), NULL, true);
    Is there a way around this problem?
    Thanks.

    Yes, you are hitting the MAX_PATH on certain versions of Windows.   The only workaround would be to see that the file is "a very long path" and then break up the pathname construction into multiple pieces (perhaps the containing directory and then the file itself).  The other option is don't use Cstring to construct, use the Unicode variant.
    From: Adobe Forums <[email protected]<mailto:[email protected]>>
    Reply-To: "[email protected]<mailto:[email protected]>" <[email protected]<mailto:[email protected]>>
    Date: Mon, 7 Nov 2011 15:43:33 -0800
    To: Leonard Rosenthol <[email protected]<mailto:[email protected]>>
    Subject: Issue with length of file paths - Windows &amp; C++ plugin
    Issue with length of file paths - Windows & C++ plugin
    created by zephed56<http://forums.adobe.com/people/zephed56> in Acrobat SDK - View the full discussion<http://forums.adobe.com/message/4012710#4012710

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

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

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

  • File upload conflict with BC4JRequestProcessor under 10g

    Hello.
    I'm using file upload in application designed in JDeveloper 9i with STRUTS framework. Request processor is BC4JRequestProcessor. Application uses file upload performed with form derrived from ActionForm with property of interface FormFile. Everything was OK until migration to 10g was performed. Under 10g, the NullPointerException is reported in MultipartUtil class called from BC4JRequestProcessor. Details:java.lang.NullPointerException
    at oracle.jbo.html.struts11.MultipartUtil.populate(MultipartUtil.java:227)
    at oracle.jbo.html.struts11.BC4JRequestProcessor.processPopulate(BC4JRequestProcessor.java:433)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
    ...The problem is, that method "populate" of MultipartUtil class doesn't resolve the MultipartRequestHandler parameter and the names of the parameters (Enumeration names) has than a null value. There is a NullPointerException thrown after an attempt of iteration of this enumeration.
    Any suggestions?
    Thanks.

    just found this thread
    BC4J MultipartRequestHandler is null

  • Issue with opening .PDF files after recalling from Symantec Enterprise Vault

    Good Morning,
    I am having issues with opening PDF files that have been recalled from Symantec Enterprise Vault and some of the files are anywhere from 3-4 years old.  Some files open, while others return the error: Adobe Reader could not open filename.pdf because it is not a supported file type or might have been damaged.  It is inconsistent as to which files it occurs with.  I am not ready to believe that I have that many corrupt files out there.  I am opening them on a Windows 7 Enterprise SP1 x64 desktop. Adobe 10.1.7. I have already configured the registry setting for bValidateBytesBeforeHeader that I found in another article to no avail.
    The files are on a network share, but I also tried copying them to my local desktop and still received the error.
    I have seen other posts regarding this error, but do not see a definitive solution and am hoping that in recent days someone has come up with a solution.
    Thank You
    Brian Dougherty

    Not supported file type can (but not always) mean the PDF was created with an old enough version of Acrobat, that it isn't comaptible with reader X or XI.
    Might have been damaged is pretty cut and dried in its meaning and interpretation.
    There's a known issue with Mac OS and Safari Browser "breaking" PDFs as they download, but it's not so common for Windows. Since these are files you already had, it would be even less applicable.
    You can try downloading an older version of Reader to check if it's a compatibility issue, but you'd have to uninstall the latest to do it and it'd be a lot of bother if they still don't open. It would also mean they are "broken" and cannot be repaired, that I know of.

  • What is best way dealing with large tiff file in OSX Lion?

    I'm working with large tiff  file (engineering drawing), but preview couldnt handle (unresponsive) this situation.
    What is best way dealing with large tiff file in OSX Lion? (Viewing only or simple editing)
    Thx,
    54n9471

    Use an iPad and this app http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=400600005&mt=8

  • Speed up Illustrator CC when working with large vector files

    Raster (mainly) files up to 350 Mb. run fast in Illustrator CC, while vector files of 10 Mb. are a pain in the *blieb* (eg. zooming & panning). When reading the file it seems to freeze around 95 % for a few minutes. Memory usage goes up to 6 Gb. Processor usage 30 - 50 %.
    Are there ways to speed things up while working with large vector files in Illustrator CC?
    System:
    64 bit Windows 7 enterprise
    Memory: 16 Gb
    Processor: Intel Xeon 3,7 GHz (8 threads)
    Graphics: nVidia Geforce K4000

    Files with large amounts vector points will put a strain on the fastest of computers. But any type of speed increase we can get you can save you lots of time.
    Delete any unwanted stray points using  Select >> Object >> stray points
    Optimize performance | Windows
    Did you draw this yourself, is the file as clean as can be? Are there any repeated paths underneath your art which do not need to be there from live tracing or stock art sites?
    Check the control panel >> programs and features and sort by installed recently and uninstall anything suspicious.
    Sorry there will be no short or single answer to this, as per the previous poster using layers effectively, and working in outline mode when possible might the best you can do.

  • Anyone having issues with importing CR2 files into lightroom 5 as error message comes up saying "Some import operations were not performed". please advise what is a solution please

    Urgent please
    anyone having issues with importing CR2 files into lightroom 5 as error message comes up saying "Some import operations were not performed". please advise what is a solution please

    Sounds like the folder Write permissions issue described here with a solution:
    "Some import operations were not performed" from camera import

Maybe you are looking for