How to upload file by using uploadify

I'm using uploadify to upload file

There is Jsp Code

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/common/tags.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN">
        <link href="${path }/css/uploadify.css" rel="stylesheet" />
        <script type="text/javascript" src="${path }/js/jquery-1.7.2.min.js"></script>
        <script type="text/javascript" src="${path }/js/swfobject.js"></script>
        <script type="text/javascript" src="${path }/js/jquery.uploadify.min.js"></script>
            $("#uploadify").uploadify( {
                'swf' : '${path }/js/uploadify.swf',
                'uploader' : '${path }/js/uploadify.swf',
                'script' : '${path }/sys/addImage',
                'queueID' : 'fileQueue',
                'queueSizeLimit' : 5,
                'fileTypeDesc' : 'exts',
                'fileTypeExts' : '*.bmp;*.jpg;*.jpeg;*.png', 
                'method' : 'post',
                'fileSizeLimit' : 10000,
                'auto' : false,
                'multi' : true,
                'uploadLimit' : 5,
                'buttonText' : 'browse',
                'onUploadError' : function (file, errorCode, errorMsg, errorString) {
                    alert("errorCode:" + errorCode + "\n" + "errorMsg:" + errorMsg + "\n" + "errorString:" + errorString);
                'onUploadSuccess' : function (file, data, response) {
        <div id="fileQueue"></div>
        <input type="file" name="fileupload" id="uploadify" />

and Struts Action code

public class ImageAction extends BaseAction {

    private File fileupload;

    private String fileuploadFileName;

    public File getFileupload() {
        return fileupload;

    public void setFileupload(File fileupload) {
        this.fileupload = fileupload;

    public String getFileuploadFileName() {
        return fileuploadFileName;

    public void setFileuploadFileName(String fileuploadFileName) {
        this.fileuploadFileName = fileuploadFileName;

    @Action(value = "addImage")
    public void addImage() {
        String newFileName = "", extName = "";

        String savePath = request.getSession().getServletContext().getRealPath("/"); 
        savePath = savePath + getImgFloder();

        if (fileuploadFileName.lastIndexOf(".") >= 0) {
            extName = fileuploadFileName.substring(fileuploadFileName.lastIndexOf("."));

        newFileName = savePath + UUID.randomUUID().toString() + extName;
        fileupload.renameTo(new File(newFileName));

i set a breakpoint at top line of addImage()

when i select some files and execute $("#uploadify").uploadify('upload','*');

the event onUploadSuccess is trigger, but the breakpoint is not trigger

how to solve it?


Need Your Help

Digest verification failed

wif adfs2.0 adfs

I'm developing a .NET web application which uses ADFS to manage users and logins. On my personal development machine and on our testing environment everything works fine. However, after publishing ...

Get URL of a website at runtime

c# winforms url

Is there any way to get a URL from a website e.g at runtime. Because I am taking book name as input for getting book reviews from goodreads and I also have written a js function to co...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.