Package org.apache.commons.fileupload

Examples of org.apache.commons.fileupload.FileItemStream.openStream()


      try {
        FileItemIterator iter = uploadParser.getItemIterator(ureq.getHttpReq());
        while (iter.hasNext()) {
          FileItemStream item = iter.next();
          String itemName = item.getFieldName();
          InputStream itemStream = item.openStream();
          if (item.isFormField()) {
            // Normal form item
            // analog to ureq.getParameter in non-multipart mode
            String value = Streams.asString(itemStream, "UTF-8");
            addRequestParameter(itemName, value);
View Full Code Here


        try {
          iter = upload.getItemIterator(request);
          InputStream stream = null;
          while (iter.hasNext()) {
            FileItemStream item = iter.next();
            stream = item.openStream();
            if (item.isFormField()) {
              parameters.put(item.getFieldName(),
                Streams.asString(stream, "UTF-8"));
            } else {
              files.add(new FileItem(item,
View Full Code Here

        if (request.getParameter("CKEditorFuncNum") != null) {
          ckeditorFuncNum = request.getParameter("CKEditorFuncNum");
        }
        while (iter.hasNext()) {
          FileItemStream item = iter.next();
          stream = item.openStream();
          if (item.isFormField()) {
            parameters.put(item.getFieldName(),
                Streams.asString(stream, "UTF-8"));
          } else {
            UploadItem uploadItem = new UploadItem();
View Full Code Here

                    continue;
                }
                if (!Arrays.asList("jpeg", "jpg", "bmp", "png", "gif").contains(PhotoService.getExtension(name))) {
                    continue;
                }
                InputStream stream = item.openStream();
                ByteArrayOutputStream out = new ByteArrayOutputStream();
                int len;
                byte[] buffer = new byte[8192];
                while ((len = stream.read(buffer, 0, buffer.length)) != -1) {
                    out.write(buffer, 0, len);
View Full Code Here

        // Parse the request
        try {
            FileItemIterator iter = upload.getItemIterator(request);
            while (iter.hasNext() == true) {
                FileItemStream item = iter.next();
                InputStream stream = item.openStream();
                if (item.isFormField() == false) {
                    /*
                     * The name given should have a .jar extension. Check this here. If
                     * not, return an error. If so, parse out just the module name.
                     */
 
View Full Code Here

    upload.setSizeMax(50000);
    try {
      FileItemIterator iterator = upload.getItemIterator(req);
      while (iterator.hasNext()) {
        FileItemStream item = iterator.next();
        InputStream in = item.openStream();
        if (item.isFormField()) {
          String fieldName = item.getFieldName();
          if (fieldName.equals("phoneNumber")) {
            phoneNumber = Streams.asString(in, "UTF-8");
          } else if (fieldName.equals("defaultCountry")) {
View Full Code Here

//         FileItem item = (FileItem)items.get(ct);

        String name = item.getName();
        //(name + " jiql UREEAD 1aay " + item.isFormField() + ":" + name.equals("directValues"));

InputStream stream = item.openStream();
//InputStream stream = item.getInputStream();

////(name + " jiql UREEAD 1 " + stream.available());
//byte[] b = StreamUtil.readBytes(stream);
View Full Code Here

      FileItemIterator iterator = upload.getItemIterator(request);

      while (iterator.hasNext()) {
        FileItemStream itemStream = iterator.next();
        InputStream in = itemStream.openStream();

        if (LOG.isDebugEnabled())
          LOG.debug("Found item " + itemStream.getFieldName());
        if (itemStream.isFormField()) {
          LOG.debug("Item is a normal form field");
View Full Code Here

            values = new ArrayList<FileItemStream>();
            fileValues = new ArrayList<String>();
          }

          values.add(itemStream);
          fileValues.add(IOUtils.toString(itemStream.openStream(),
              "ISO-8859-1"));
          files.put(itemStream.getFieldName(), values);
          fileContents.put(itemStream.getFieldName(), fileValues);
        }
      }
View Full Code Here

                resp.setContentType("text/plain");
                FileItemIterator iterator = upload.getItemIterator(req);

                while (iterator.hasNext()) {
                    FileItemStream item = iterator.next();
                   InputStream stream = item.openStream();
                  if (item.isFormField()) {
                        System.out.println("Got a form field: " + item.getFieldName()  + " " +item);
                 } else{
                       System.out.println("Got an uploaded file: " + item.getFieldName() +
                                  ", name = " + item.getName());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.