commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From loredana loredana <>
Subject get image dimensions before upload?
Date Thu, 13 Dec 2007 13:01:53 GMT
Hi, i'm new to this list. I have a question. I have a page where a user can upload a image
on the server. The way I did it was pretty basic:

        boolean isMultipart = ServletFileUpload.isMultipartContent(request);
        FileItemFactory factory = new DiskFileItemFactory();
        ServletFileUpload upload = new ServletFileUpload(factory);
        List items=null;
        items = upload.parseRequest(request);
        Iterator iter = items.iterator();
        while (iter.hasNext()) {
            FileItem item = (FileItem);
            File uploadedFile = new File("image.gif");

I need to make sure that the image the user uploads is of height 150 and width 100 ....I can
probably do that by saving the uploaded file, check the dimensions and delete it in case it's
doesn't have the necesary size. But is there a way to check this before the file is uploaded?

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message