1. the HTML form Element [html] & lt; inputtype & quot; file & quot; name & quot; fileImg & quot; id & quot; fileImg & quot;/& gt; & lt; divid & quot; fileQueue & quot; & gt; & lt;/div & gt; & lt; ahref & quot; jav
1. HTML form elements
[Html]
Upload...
Upload...
2. Plug-in Initialization
[Javascript]
$ ("# FileImg"). uploadify ({
'Upload': '$ {ctx}/handlePicture. action? JSESSIONID =$ {pageContext. session. id }',
'Swf ':' $ {ctx}/js/uploadify/uploadify.swf ',
'Canonicalimg': '$ {ctx}/js/uploadify/cancel.png ',
'Fileobjname': 'fileimg ',
'Queue id': 'filequeue ',
'Auto': false,
'Buttontext': 'select ',
'Filesizelimmit ': '50mb ',
'Multi ': false,
'Height': 20,
'Wmode': 'transparent ',
// Upload the completed current event
'Onuploadsuccess': function (file, data, response ){
Data = eval ("(" + data + ")");
If (data. status = '1 ')
{
$. Messager. alert ('prompt: ', 'upload successful', 'info ');
$ ("# ImgView"). attr ("src", ctx + "/" + data. object );
$ ("# Picturew"). val (data. object. substring (data. object. lastIndexOf ("/") + 1 ));
}
Else
{
$. Messager. alert ('prompt: ', 'upload failed', 'info ');
}
}
});
$ ("# FileImg"). uploadify ({
'Upload': '$ {ctx}/handlePicture. action? JSESSIONID =$ {pageContext. session. id }',
'Swf ':' $ {ctx}/js/uploadify/uploadify.swf ',
'Canonicalimg': '$ {ctx}/js/uploadify/cancel.png ',
'Fileobjname': 'fileimg ',
'Queue id': 'filequeue ',
'Auto': false,
'Buttontext': 'select ',
'Filesizelimmit ': '50mb ',
'Multi ': false,
'Height': 20,
'Wmode': 'transparent ',
// Upload the completed current event
'Onuploadsuccess': function (file, data, response ){
Data = eval ("(" + data + ")");
If (data. status = '1 ')
{
$. Messager. alert ('prompt: ', 'upload successful', 'info ');
$ ("# ImgView"). attr ("src", ctx + "/" + data. object );
$ ("# Picturew"). val (data. object. substring (data. object. lastIndexOf ("/") + 1 ));
}
Else
{
$. Messager. alert ('prompt: ', 'upload failed', 'info ');
}
}
});
3. Upload out
[Html]
Function upload ()
{
$ ("# FileImg"). uploadify ("settings", "formData", {'jsessionid': '$ {pageContext. session. id }'});
$ ("# FileImg"). uploadify ("upload ");
}
Function upload ()
{
$ ("# FileImg"). uploadify ("settings", "formData", {'jsessionid': '$ {pageContext. session. id }'});
$ ("# FileImg"). uploadify ("upload ");
}