Java Code Examples for org.springframework.web.multipart.MultipartFile#transferTo()

The following examples show how to use org.springframework.web.multipart.MultipartFile#transferTo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WebSiteService.java    From roncoo-jui-springboot with Apache License 2.0 6 votes vote down vote up
public int updateById(WebSiteQO qo, MultipartFile file) {
	if (!file.isEmpty()) {
		// 上传
		String fileName = file.getOriginalFilename();// 文件名
		String filePath = ConfUtil.FILEPATH;
		filePath = filePath + SecureUtil.simpleUUID() + fileName.substring(fileName.lastIndexOf(".")); // 注意,linux下文件名为中文的情况
		logger.warn("当前上传的文件名为:{},上传的目录位置:{}", fileName, filePath);
		File dest = new File(filePath);
		if (!dest.getParentFile().exists()) {
			// 判断文件父目录是否存在
			dest.getParentFile().mkdirs();
		}
		try {
			// 保存文件
			file.transferTo(dest);
		} catch (IllegalStateException | IOException e) {
			e.printStackTrace();
		}
		qo.setSiteLogo(dest.getName());
	}
	WebSite record = new WebSite();
	BeanUtils.copyProperties(qo, record);
	return dao.updateById(record);
}
 
Example 2
Source File: FileUploadController.java    From springboot-learning-experience with Apache License 2.0 6 votes vote down vote up
@PostMapping("/upload2")
@ResponseBody
public List<Map<String, String>> upload2(@RequestParam("file") MultipartFile[] files) throws IOException {
    if (files == null || files.length == 0) {
        return null;
    }
    List<Map<String, String>> results = new ArrayList<>();
    for (MultipartFile file : files) {
        // TODO Spring Mvc 提供的写入方式
        file.transferTo(new File("/Users/Winterchen/Desktop/javatest" + file.getOriginalFilename()));
                Map<String, String> map = new HashMap<>(16);
        map.put("contentType", file.getContentType());
        map.put("fileName", file.getOriginalFilename());
        map.put("fileSize", file.getSize() + "");
        results.add(map);
    }
    return results;
}
 
Example 3
Source File: CookBookServiceImpl.java    From Java-Deep-Learning-Cookbook with MIT License 6 votes vote down vote up
@Override
public List<String> generateStringOutput(MultipartFile multipartFile, String modelFilePath) throws IOException, InterruptedException {
    final List<String> results = new ArrayList<>();
    File convFile = File.createTempFile(multipartFile.getOriginalFilename(),null, new File(System.getProperty("user.dir")+"/"));
    multipartFile.transferTo(convFile);
    INDArray indArray = CustomerRetentionPredictionApi.generateOutput(convFile, modelFilePath);
    for(int i=0; i<indArray.rows();i++){
        if(indArray.getDouble(i,0)>indArray.getDouble(i,1)){
            results.add("Customer "+(i+1)+"-> Happy Customer \n");
        }
        else{
            results.add("Customer "+(i+1)+"-> Unhappy Customer \n");
        }
    }
    convFile.deleteOnExit();

    return results;
}
 
Example 4
Source File: TerminalController.java    From JobX with Apache License 2.0 6 votes vote down vote up
@RequestMapping(value = "upload.do", method = RequestMethod.POST)
@ResponseBody
public Status upload(HttpSession httpSession, String token, @RequestParam(value = "file", required = false) MultipartFile file, String path) {
    Status status = Status.TRUE;
    String tmpPath = httpSession.getServletContext().getRealPath("/") + "upload" + File.separator;
    File tempFile = new File(tmpPath, file.getOriginalFilename());
    try {
        file.transferTo(tempFile);
        if (CommonUtils.isEmpty(path)) {
            path = ".";
        } else {
            if (path.endsWith("/")) {
                path = path.substring(0, path.lastIndexOf("/"));
            }
        }

        if (!Constants.JOBX_CLUSTER) {
            return terminalOneProcessor.upload(token, tempFile, path + "/" + file.getOriginalFilename(), file.getSize());
        }
        terminalClusterProcessor.doWork("upload", status, token, tempFile, path + "/" + file.getOriginalFilename(), file.getSize());
        tempFile.delete();
    } catch (Exception e) {
    }
    return status;
}
 
Example 5
Source File: UploadController.java    From Spring with Apache License 2.0 6 votes vote down vote up
/**
 * curl -F file=@/home/olinnyk/IdeaProjects/Spring/SpringWEB/SpringBoot/just-gif-it/video/PexelsVideos.mp4 -F start=0 -F end=5 -F speed=1 -F repeat=0 localhost:8080/upload
 */
@PostMapping
@RequestMapping(value = "/upload", produces = MediaType.IMAGE_GIF_VALUE)
public String upload(@RequestPart("file") MultipartFile file,
		@RequestParam("start") int start,
		@RequestParam("end") int end,
		@RequestParam("speed") int speed,
		@RequestParam("repeat") boolean repeat) throws IOException, FrameGrabber.Exception {

	final File videoFile = new File(location + "/" + System.currentTimeMillis() + ".mp4");
	file.transferTo(videoFile);

	log.info("Saved video file to {}", videoFile.getAbsolutePath());

	final Path output = Paths.get(location + "/gif/" + System.currentTimeMillis() + ".gif");

	final FFmpegFrameGrabber frameGrabber = videoDecoderService.read(videoFile);
	final AnimatedGifEncoder gifEncoder = gifEncoderService.getGifEncoder(repeat, (float) frameGrabber.getFrameRate(), output);
	converterService.toAnimatedGif(frameGrabber, gifEncoder, start, end, speed);

	log.info("Saved generated gif to {}", output.toString());

	return output.getFileName().toString();
}
 
Example 6
Source File: AppController.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@RequestMapping( method = RequestMethod.POST )
@PreAuthorize( "hasRole('ALL') or hasRole('M_dhis-web-app-management')" )
@ResponseStatus( HttpStatus.NO_CONTENT )
public void installApp( @RequestParam( "file" ) MultipartFile file )
    throws IOException, WebMessageException
{
    File tempFile = File.createTempFile( "IMPORT_", "_ZIP" );
    file.transferTo( tempFile );

    AppStatus status = appManager.installApp( tempFile, file.getOriginalFilename() );

    if ( !status.ok() )
    {
        String message = i18nManager.getI18n().getString( status.getMessage() );

        throw new WebMessageException( WebMessageUtils.conflict( message ) );
    }
}
 
Example 7
Source File: UploadServiceImpl.java    From xechat with MIT License 6 votes vote down vote up
private String execute(MultipartFile multipartFile) throws Exception {
    String originalFilename = multipartFile.getOriginalFilename();
    if (StringUtils.isEmpty(originalFilename)) {
        throw new ErrorCodeException(CodeEnum.INVALID_PARAMETERS);
    }

    String type = originalFilename.substring(originalFilename.lastIndexOf(".") + 1);
    if (!CheckUtils.isImage(type)) {
        throw new ErrorCodeException(CodeEnum.UPLOADED_FILE_IS_NOT_AN_IMAGE);
    }

    String fileName = UUIDUtils.create() + "." + type;
    String respPath = fileConfig.getAccessAddress() + fileName;

    File file = new File(fileConfig.getDirectoryMapping() + fileConfig.getUploadPath() + fileName);
    if (!file.getParentFile().exists()) {
        file.getParentFile().mkdirs();
    }

    multipartFile.transferTo(file);

    return respPath;
}
 
Example 8
Source File: BookController.java    From bookshop with MIT License 5 votes vote down vote up
/**
 * 更新图书内容
 * @param request 用于获取路径
 * @param book 除图片外其他的图书信息
 * @param file 图片
 * @return
 * 应该使用PUT,可是需要上传图片,表单提交无法用PUT,待解决
 */
@RequestMapping(value = "/renewal",method = RequestMethod.POST)
public Result editBook(HttpServletRequest request, Book book,
                       @RequestParam(value = "image" , required = false) MultipartFile file){
    try {
        bookService.update(book);
        if (file != null) {
            BookImage bookImage = bookImageService.getByBookId(book.getId());
            bookImage.setBook(book);
            bookImageService.update(bookImage);
            String imageName = bookImage.getId() + ".jpg";
            String imagePath = request.getServletContext().getRealPath("/img/book-list/article/");
            File filePath = new File(imagePath, imageName);
            if (!filePath.getParentFile().exists()) {
                filePath.getParentFile().mkdir();
            }else if (filePath.exists()){
                filePath.delete();
            }
            file.transferTo(new File(imagePath + File.separator + imageName));
        }
        log.info("request: book/update , book: " + book.toString());
        return ResultGenerator.genSuccessResult();
    } catch (IOException e) {
        e.printStackTrace();
        return ResultGenerator.genFailResult("修改失败!");
    }
}
 
Example 9
Source File: UploadController.java    From blog_demos with Apache License 2.0 5 votes vote down vote up
@RequestMapping(value="/upload",method= RequestMethod.POST)
public void upload(HttpServletRequest request,
                   HttpServletResponse response,
                   @RequestParam("comment") String comment,
                   @RequestParam("file") MultipartFile file) throws Exception {

    logger.info("start upload, comment [{}]", comment);

    if(null==file || file.isEmpty()){
        logger.error("file item is empty!");
        responseAndClose(response, "文件数据为空");
        return;
    }

    //上传文件名
    String fileName = file.getOriginalFilename();

    //得到文件保存的路径
    String savePathStr = "/usr/local/uploadfiles";

    logger.info("real save path [{}], real file name [{}]", savePathStr, fileName);

    File filepath = new File(savePathStr, fileName);

    //确保路径存在
    if(!filepath.getParentFile().exists()){
        logger.info("real save path is not exists, create now");
        filepath.getParentFile().mkdirs();
    }

    String fullSavePath = savePathStr + File.separator + fileName;

    //存本地
    file.transferTo(new File(fullSavePath));

    logger.info("save file success [{}]", fullSavePath);

    responseAndClose(response, "SpringBoot环境下,上传文件成功");
}
 
Example 10
Source File: FileUtils.java    From ywh-frame with GNU General Public License v3.0 5 votes vote down vote up
public static String[] uploadFile(MultipartFile file){
    log.info("成功获取文件");
    //获取文件名
    String fileName = file.getOriginalFilename();
    String separator = "/";
    String[] suffixName = {".jpg",".png",".mp3"};
    //判断类型
    String type = fileName.contains(".") ? fileName.substring(fileName.lastIndexOf("."), fileName.length()):"";
    log.info("文件初始名称为:" + fileName + " 类型为:" + type);
    // 2. 使用随机生成的字符串+源图片扩展名组成新的图片名称,防止图片重名
    String newfileName = UUID.randomUUID().toString().replaceAll("-","") + fileName.substring(fileName.lastIndexOf("."));
    //存放磁盘的路径以及判断有没有
    String suffix = "//" + Calendar.getInstance().get(Calendar.YEAR) + "-" + (Calendar.getInstance().get(Calendar.MONTH) + 1);
    File filePath = suffixName[2].equals(type)? new File(SAVE_PATH + "//data//" +"image" + suffix): new File(SAVE_PATH + "//data//" +"audio" + suffix);
    if (!filePath.exists() && !filePath.isDirectory()) {
        if (separator.equals(File.separator)) {
            log.info("Liunx下创建");
            filePath.setWritable(true, false);
            filePath.mkdirs();
        } else {
            log.info("windows下创建");
            filePath.mkdirs();
        }
    }
    //transferto()方法,是springmvc封装的方法,用于图片上传时,把内存中图片写入磁盘
    log.info("存储地址:" + filePath.getPath());
    try {
        file.transferTo(new File(filePath.getPath()+ "//" + newfileName));
        String[] response= new String[2];
        response[0] = filePath.getPath()+ "//" + newfileName;
        response[1] = type;
        return response;
    } catch (IOException e) {
        e.printStackTrace();
        throw MyExceptionUtil.mxe("上传文件失败!",e);
    }
}
 
Example 11
Source File: UserMgrController.java    From Guns with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * 上传图片
 *
 * @author fengshuonan
 * @Date 2018/12/24 22:44
 */
@RequestMapping(method = RequestMethod.POST, path = "/upload")
@ResponseBody
public String upload(@RequestPart("file") MultipartFile picture) {

    String pictureName = UUID.randomUUID().toString() + "." + ToolUtil.getFileSuffix(picture.getOriginalFilename());
    try {
        String fileSavePath = ConstantsContext.getFileUploadPath();
        picture.transferTo(new File(fileSavePath + pictureName));
    } catch (Exception e) {
        throw new ServiceException(BizExceptionEnum.UPLOAD_ERROR);
    }
    return pictureName;
}
 
Example 12
Source File: IndexController.java    From ssm-demo with MIT License 5 votes vote down vote up
@RequestMapping("testForm")
public String testForm(MultipartFile file, HttpServletRequest request) throws IllegalStateException, IOException{
	LOG.info("上传测试......");
	if(file.isEmpty()){
		return "ssm";
	}
	String fname = file.getOriginalFilename();
	LOG.info("文件名:"+fname);
	File localFile = new File("D:\\img", UUID.randomUUID()+fname.substring(fname.lastIndexOf(".")));
	if(!localFile.exists()){
		localFile.mkdirs();
	}
	file.transferTo(localFile);
	return "ssm.html";
}
 
Example 13
Source File: UserController.java    From EasyHousing with MIT License 5 votes vote down vote up
@RequestMapping(value="changePhoto.do", method={RequestMethod.GET,RequestMethod.POST})
@ResponseBody
public ModelAndView changePhoto(HttpServletRequest request) throws IllegalStateException, IOException {
	ModelAndView modelAndView = new ModelAndView();
	modelAndView.setViewName("/MyHome/userCenter");
	HttpSession s = request.getSession();
	User user = (User) s.getAttribute("user");
	
	// 得到文件
	String path = request.getSession().getServletContext().getRealPath("upload");  
	MultipartHttpServletRequest multiRequest=(MultipartHttpServletRequest)request;
	Iterator iter=multiRequest.getFileNames(); 
	MultipartFile file=multiRequest.getFile(iter.next().toString()); 
       String fileName = file.getOriginalFilename();    
       File dir = new File(path,fileName);          
       if(!dir.exists()){  
       	dir.mkdirs();  
       }  
       //MultipartFile自带的解析方法  
       file.transferTo(dir); 
	
       try {
       	String filePath = path + "\\" + fileName;
       	System.err.println(filePath);
       	String name = new Date().toInstant().toString();
       	new Tool().upload(filePath, name);
       	user.setUserPhoto(String.valueOf("http://os8z6i0zb.bkt.clouddn.com/" + name));
       	userService.updateUser(user);
       } catch (Exception e) {
       	modelAndView.addObject("infoMessage", "上传头像失败TAT");
       	return modelAndView;
       }
       modelAndView.addObject("infoMessage", "上传头像成功!");
	return modelAndView;
}
 
Example 14
Source File: UploadEncryptFileController.java    From Spring-MVC-Blueprints with MIT License 5 votes vote down vote up
private byte[] encryptedContent(MultipartFile multipartFile, String cipher) throws Exception, IOException{
	File convFile = new File( multipartFile.getOriginalFilename());
	multipartFile.transferTo(convFile);
	FileInputStream imageInFile = new FileInputStream(convFile);
	byte imageData[] = new byte[(int) convFile.length()];
	imageInFile.read(imageData);
	
	byte[] bytes = encryptDESFile(cipher,imageData);
	imageInFile.close();
	
	return bytes;
}
 
Example 15
Source File: FileUploadController.java    From springbootexamples with Apache License 2.0 5 votes vote down vote up
@PostMapping("/upload1")
@ResponseBody
public Map<String, String> upload1(@RequestParam("file") MultipartFile file) throws IOException {
    log.info("[文件类型] - [{}]", file.getContentType());
    log.info("[文件名称] - [{}]", file.getOriginalFilename());
    log.info("[文件大小] - [{}]", file.getSize());
    // TODO 将文件写入到指定目录(具体开发中有可能是将文件写入到云存储/或者指定目录通过 Nginx 进行 gzip 压缩和反向代理,此处只是为了演示故将地址写成本地电脑指定目录)
    
    file.transferTo(new File("D:/workspace-sts-3.9.5.RELEASE/springbootexamples/src/main/resources/static/upload/" + file.getOriginalFilename()));
    Map<String, String> result = new HashMap<>(16);
    result.put("contentType", file.getContentType());
    result.put("fileName", file.getOriginalFilename());
    result.put("fileSize", file.getSize() + "");
    return result;
}
 
Example 16
Source File: FileServiceImpl.java    From mmall-kay-Java with Apache License 2.0 5 votes vote down vote up
/**
 * 文件上传
 * @param file
 * @param path
 * @return  上传文件名称
 */
@Override
public String upload(MultipartFile file, String path) {
    //文件名
    //扩展名
    String fileName = file.getOriginalFilename();
    String fileExtensionName = fileName.substring(fileName.lastIndexOf(".") + 1);
    //上传文件名
    String uploadFileName = UUID.randomUUID().toString() + "." + fileExtensionName;

    log.info("开始长传文件,上传文件的文件名:{},上传路径:{},新文件名:{}", fileName, path, uploadFileName);

    //创建文件夹路径
    File fileDir = new File(path);
    if (!fileDir.exists()) {
        fileDir.setWritable(true);
        fileDir.mkdirs();    //mkdirs 递归创建,mkdir 只建一个,多级返回false
    }
    File targetFile = new File(path, uploadFileName);

    try {
        //上传文件到应用服务器
        file.transferTo(targetFile);

        //上传到FTP文件服务器
        FTPUtil.uploadFile(Lists.newArrayList(targetFile));

        //上传完后删除应用上的文件
        targetFile.delete();

    } catch (IOException e) {
        log.error("文件上传异常", e);
    }

    return targetFile.getName();
}
 
Example 17
Source File: UploadController.java    From newbee-mall with GNU General Public License v3.0 5 votes vote down vote up
@PostMapping({"/upload/file"})
@ResponseBody
public Result upload(HttpServletRequest httpServletRequest, @RequestParam("file") MultipartFile file) throws URISyntaxException {
    String fileName = file.getOriginalFilename();
    String suffixName = fileName.substring(fileName.lastIndexOf("."));
    //生成文件名称通用方法
    SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss");
    Random r = new Random();
    StringBuilder tempName = new StringBuilder();
    tempName.append(sdf.format(new Date())).append(r.nextInt(100)).append(suffixName);
    String newFileName = tempName.toString();
    File fileDirectory = new File(Constants.FILE_UPLOAD_DIC);
    //创建文件
    File destFile = new File(Constants.FILE_UPLOAD_DIC + newFileName);
    try {
        if (!fileDirectory.exists()) {
            if (!fileDirectory.mkdir()) {
                throw new IOException("文件夹创建失败,路径为:" + fileDirectory);
            }
        }
        file.transferTo(destFile);
        Result resultSuccess = ResultGenerator.genSuccessResult();
        resultSuccess.setData(NewBeeMallUtils.getHost(new URI(httpServletRequest.getRequestURL() + "")) + "/upload/" + newFileName);
        return resultSuccess;
    } catch (IOException e) {
        e.printStackTrace();
        return ResultGenerator.genFailResult("文件上传失败");
    }
}
 
Example 18
Source File: FileChunkController.java    From zuihou-admin-boot with Apache License 2.0 4 votes vote down vote up
/**
 * 分片上传
 * 该接口不能用作 单文件上传!
 *
 * @param info
 * @param file
 * @return
 */
@ApiOperation(value = "分片上传", notes = "前端通过webUploader获取截取分片, 然后逐个上传")
@RequestMapping(value = "/upload", method = RequestMethod.POST)
@ResponseBody
public R<String> uploadFile(FileUploadDTO info, @RequestParam(value = "file", required = false) MultipartFile file) throws Exception {
    String uploadFolder = FileDataTypeUtil.getUploadPathPrefix(fileProperties.getStoragePath());
    //验证请求不会包含数据上传,所以避免NullPoint这里要检查一下file变量是否为null
    if (file == null || file.isEmpty()) {
        log.error("请求参数不完整");
        return R.fail("请求参数不完整");
    }

    log.info("info={}", info);
    /*
    将MD5签名和合并后的文件path存入持久层,注意这里这个需求导致需要修改webuploader.js源码3170行
    因为原始webuploader.js不支持为formData设置函数类型参数,这将导致不能在控件初始化后修改该参数
    文件大小 小于 单个分片时,会执行这里的代码
    */
    if (info.getChunks() == null || info.getChunks() <= 0) {
        File upload = fileStrategy.upload(file);

        FileAttrDO fileAttrDO = fileService.getFileAttrDo(info.getFolderId());
        upload.setFolderId(info.getFolderId());
        upload.setFileMd5(info.getMd5());
        upload.setFolderName(fileAttrDO.getFolderName());
        upload.setGrade(fileAttrDO.getGrade());
        upload.setTreePath(fileAttrDO.getTreePath());
        fileService.save(upload);
        return R.success(file.getOriginalFilename());
    } else {
        //为上传的文件准备好对应的位置
        java.io.File target = wu.getReadySpace(info, uploadFolder);
        log.info("target={}", target.getAbsolutePath());
        if (target == null) {
            return R.fail(wu.getErrorMsg());
        }
        //保存上传文件
        file.transferTo(target);
        return R.success(target.getName());
    }


}
 
Example 19
Source File: NetdiskController.java    From SimpleBBS with Apache License 2.0 4 votes vote down vote up
/**
 * 处理文件上传
 *
 * @param file
 * @param session
 * @return
 */
@PostMapping(value = "/upload.do")
public String upload(MultipartFile file, HttpSession session, Model model) {

    User user = (User) session.getAttribute("user");
    if (user == null) {  //未登录
        return "redirect:/";
    }

    if (file.getSize() > fileService.getAvailableSizeByUid(user.getUid())) {
        model.addAttribute("message", "你的剩余容量不足,充钱才能变得更强");
        return "error";
    }
    if (file.getSize() <= 0 || file.getSize() > NetdiskConfig.GB_1) //文件大小不符合范围
    {

        return "redirect:/netdisk.do";
    }

    String fileName = file.getOriginalFilename();   //获取文件名
    if (!fileName.contains("."))          //源文件无格式,避免后续处理出错
        fileName = fileName + ".unknow";

    String[] formatNames = fileName.split("\\.");//获取文件格式
    String formatName = "." + formatNames[formatNames.length - 1];
    String filePath = fileUploadProperteis.getUploadFolder();// 获取配置E:\\file


    java.io.File folder = new java.io.File(filePath);       //检测文件夹是否存在
    if (!folder.exists())
        folder.mkdirs();
    String uuid = UUIDUtils.generateUUID();
    java.io.File dest = new java.io.File(filePath + "/" + uuid + formatName);

    try {
        file.transferTo(dest);

        File fileInfo = new com.zzx.model.File();
        fileInfo.setFileName(fileName);
        fileInfo.setFilePath(fileUploadProperteis.getStaticAccessPath().replaceAll("\\*", "") + uuid + formatName);
        fileInfo.setFileSize(file.getSize());
        fileInfo.setUploadTime(new Date());
        fileInfo.setState(1);
        fileInfo.setUser(user);
        fileService.saveFileInfo(fileInfo);

        return "redirect:/netdisk.do";
    } catch (IOException e) {
        e.printStackTrace();
        return "error";
    }
}
 
Example 20
Source File: AuthoringController.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
    * Imports questions into question bank from uploaded xml file.
    */
   @SuppressWarnings("unchecked")
   @RequestMapping("/importQuestions")
   public String importQuestions(@RequestParam("UPLOAD_FILE") MultipartFile file, HttpServletRequest request) throws ServletException {
SessionMap<String, Object> sessionMap = getSessionMap(request);
SortedSet<AssessmentQuestion> oldQuestions = getQuestionList(sessionMap);

List<String> toolsErrorMsgs = new ArrayList<>();
try {
    String uploadPath = FileUtil.createTempDirectory("_uploaded_2questions_xml");

    // filename on the client
    String filename = FileUtil.getFileName(file.getOriginalFilename());
    File destinationFile = new File(uploadPath, filename);
    file.transferTo(destinationFile);

    String fileExtension = FileUtil.getFileExtension(filename);
    if (!fileExtension.equalsIgnoreCase("xml")) {
	throw new RuntimeException("Wrong file extension. Xml is expected");
    }
    // String learningDesignPath = ZipFileUtil.expandZip(new FileInputStream(designFile), filename2);

    // import learning design
    String fullFilePath = destinationFile.getAbsolutePath();// FileUtil.getFullPath(learningDesignPath,
						       // ExportToolContentService.LEARNING_DESIGN_FILE_NAME);
    List<AssessmentQuestion> questions = (List<AssessmentQuestion>) FileUtil.getObjectFromXML(null,
	    fullFilePath);
    if (questions != null) {
	for (AssessmentQuestion question : questions) {
	    int maxSeq = 1;
	    if ((oldQuestions != null) && (oldQuestions.size() > 0)) {
		AssessmentQuestion last = oldQuestions.last();
		maxSeq = last.getSequenceId() + 1;
	    }
	    question.setSequenceId(maxSeq);
	    oldQuestions.add(question);
	}
    }

} catch (Exception e) {
    log.error("Error occured during import", e);
    toolsErrorMsgs.add(e.getClass().getName() + " " + e.getMessage());
}

if (toolsErrorMsgs.size() > 0) {
    request.setAttribute("toolsErrorMessages", toolsErrorMsgs);
}

reinitializeAvailableQuestions(sessionMap);
return "pages/authoring/parts/questionlist";
   }