当前位置:首页 » 文件管理 » jquery的上传插件下载

jquery的上传插件下载

发布时间: 2022-09-12 18:34:47

① 有哪些好用的 jQuery 图片上传插件

1、uploadify
它是针对jQuery的免费文件上传插件,可以轻松将单个或多个文件上传到网站上,可控制并发上传的文件数,通过接口参数和CSS控制外观。Web服务器需支持flash和后端开发语言。

2、FancyUpload
它是一个由CSS和XHTML编写样式的Ajax文件上传工具,安装简便,服务器独立,由MooTools模块驱动,可以在任何现代浏览器上使用。

3、Aurigma Upload Suite(Image Uploader)
这是一个不限大小,不限格式的文件/图片批量上传工具,是收费控件。它支持云端存储和客户端文件处理,支持断点续传,稳定可靠。从8.0.8开始,Image Uploader将名称改为"Aurigma Upload Suite"。

② jquery 上传文件插件uploadify jsp版本

写一个servlet,看这里
http://www.javaeye.com/topic/376101

③ 如何安装jQuery插件

在html中引入jquery插件的方法有以下两种:
1:CDN引入,在head标签中加入下列代码

<head>
<script src="http://libs..com/jquery/2.0.0/jquery.js"></script>>
</script>
</head>

2:本地引入,这种方法要求本地有jquery.js:
<head>
<script src="jquery.js"></script>>
</script>
</head>

jquery可以到其官网下载,官网地址是www.jquery.com;
JQuery是继prototype之后又一个优秀的Javascript库。它是轻量级的js库 ,它兼容CSS3,还兼容各种浏览器。推荐使用CDN,许多用户在访问其他站点时,已经从其他加载过 jQuery。所有结果是,当他们访问您的站点时,会从缓存中加载 jQuery,这样可以减少加载时间。同时,大多数 CDN 都可以确保当用户向其请求文件时,会从离用户最近的服务器上返回响应,这样也可以提高加载速度。

④ 请问ASP要如何使用jquery的插件uploadify,官网上的只有php

Uploadify简单说来,是基于Jquery的一款文件上传插件。它的功能特色总结如下:

支持单文件或多文件上传,可控制并发上传的文件数

在服务器端支持各种语言与之配合使用,诸如PHP,.NET,Java……

通过参数可配置上传文件类型及大小限制

通过参数可配置是否选择文件后自动上传

易于扩展,可控制每一步骤的回调函数(onSelect, onCancel……)

通过接口参数和CSS控制外观

更多……

相关链接

Uploadify主页地址:http://www.uploadify.com/ 在该页面你可以了解到关于他的更多内容。

Uploadify在线演示:在线Demo

Uploadify配置参数及接口文档:http://www.uploadify.com/documentation

Uploadify插件下载地址:http://www.uploadify.com/download

使用方法

下载插件安装包后,可以看到里面的几个主要文件:jquery.uploadify.js(完成上传功能的脚本文件,在调用页面引用)、uploadify.css(外观样式表)、uploader.swf(上传控件的主体文件,flash控件)、upload.php(服务器端处理文件,官方仅提供了php版的)

引用了插件文件后,在页面中做如下调用:

//声明一个普通的html文件上传控件,并指定id

<input type="file" name="fileInput" id="fileInput" />

//将声明的普通上传控件与Uploadify插件绑定

<script type="text/javascript">

$(document).ready(function() {

$('#fileInput').fileUpload ({

//以下参数均是可选

'uploader' : 'uploader.swf', //指定上传控件的主体文件,默认‘uploader.swf’

'script' : 'upload.php', //指定服务器端上传处理文件,默认‘upload.php’

'cancelImg' : 'cancel.png', //指定取消上传的图片,默认‘cancel.png’

'auto' : true, //选定文件后是否自动上传,默认false

'folder' : '/uploads' //要上传到的服务器路径,默认‘/’

'muti' : true, //是否允许同时上传多文件,默认false

'fileDesc' : 'rar文件或zip文件' //出现在上传对话框中的文件类型描述

'fileExt' : '*.rar;*.zip', //控制可上传文件的扩展名,启用本项时需同时声明fileDesc

'sizeLimit': 86400 //控制上传文件的大小,单位byte

'simUploadLimit' :5 //多文件上传时,同时上传文件数目限制

});

});

</script>

上面列出了我认为常用的配置选项,此外还有很多参数可配置,参考官方文档

通过调用相关功能函数,声明功能按钮。

例如声明上传功能按钮(自动上传时不需要):

<a href="javascript:$('#fileInput').fileUploadStart();">上传文件</a>

声明取消多文件上传时上传队列:

<a href="javascript:$('#fileInput').fileUploadClearQueue();">取消上传队列</a>

文章来自中国建站:http://www.jz123.cn/text/2419333.html

⑤ jquery有哪些插件

//200多个插件如下实际开发中请选择合适的使用
1:文件上传类jQuery插件
AjaxFileUpload.
jQUploader.
MultipleFileUploadplugin.
jQueryFileStyle.
Stylinganinputtypefile.
ProgressBarPlugin.
2:表单验证类jQuery插件
jQueryValidation.
AutoHelp.
SimplejQueryformvalidation.
jQueryXAV–formvalidations.
jQueryAlphaNumeric.
MaskedInput.
TypeWatchPlugin.
Textlimiterforformfields.
AjaxUsernameCheckwithjQuery.
3:表单选择框类jQuery插件
jQueryCombobox.
jQuerycontrolleddependent(orCascadign)SelectList.
MultipleSelects.
Selectboxmanipulation.
SelectComboPlugin.
jQuery–LinkedSelect
Auto-populatemultipleselectboxes.
ChoosePlugin(SelectReplacement).
4:表单基本、输入框、选择框等jQuery插件
jQueryFormPlugin.
jQuery-Form.
jLookNiceForms.
jNice.
PingPlugin.
ToggleFormText.
ToggleVal.
jQueryFieldPlugin.
jQueryForm’nFieldplugin.
jQueryCheckboxmanipulation.
jTagging.
jQuerylabelcheck.
Overlabel.
3stateradiobuttons.
ShiftCheckboxjQueryPlugin.
WatermarkInput.
jQueryCheckbox(checkboxeswithimags).
jQuerySpinButtonControl.
jQueryAjaxFormBuilder.
jQueryFocusFields.
jQueryTimeEntry.
5:时间、日期和颜色选取类jQuery插件
jQueryUIDatepicker.
jQuerydatepickerplugin.
jQueryTimePicker.
TimePicker.
ClickPick.
TimePicker.
.
ColorPickerbyintelliance.fr.
6:投票类jQuery插件
jQueryStarRatingPlugin.
jQueryStarRater.
Contentraterwithasp.net,ajaxandjQuery.
Half-StarRatingPlugin.
7:搜索类jQuery插件
jQuerySuggest.
jQueryAutocomplete.
jQueryAutocompleteMod.
jQueryAutocompletebyAjaxDaddy.
.
jQueryAutocompleter.
AutoCompleter(TutorialwithPHP&MySQL).
quickSearchjQueryPlugin.
8:jQuery编辑器插件
jTagEditor.
WYMeditor.
jQueryjFrame.
Jeditable–editinplacepluginforjQuery.
jQueryeditable.
jQueryDisableTextSelectPlugin.
.
jQueryPlugin–AnotherIn-PlaceEditor.
TableEditor.
tEditable–inplacetableeditingforjQuery.
9:多媒体、视频、Flash等类jQuery插件
jMedia–accessiblemulti-mediaembedding.
JBEdit–AjaxonlineVideoEditor.
jQueryMP3Plugin.
jQueryMediaPlugin.
jQueryFlashPlugin.
EmbedQuickTime.
SVGIntegration.
图片类jQuery插件
ThickBox.
jQuerylightBoxplugin.
jQueryImageStrip.
jQueryslideViewer.
jQueryjqGalScroll2.0.
jQuery–jqGalViewII.
jQuery–jqGalViewIII.
jQueryPhotoSlider.
jQueryThumbs–easilycreatethumbnails.
jQueryjQIRImageReplacement.
jCarouselLite.
jQPanView.
jCarousel.
InterfaceImagebox.
ImageGalleryusingjQuery,Interface&Reflactions.
simplejQueryGallery.
jQueryGalleryMole.
EOGallery.
jQueryScrollShow.
jQueryCyclePlugin.
jQueryFlickr.
jQueryLazyLoadImagesPlugin.
Zoomi–ZoomableThumbnails.
jQueryCrop–cropanyimageonthefly.
ImageReflection.
10:Google地图类jQuery插件应用
jQueryPlugingooglemaps.
jMapsjQueryMapsFramework.
jQmaps.
jQuery&GoogleMaps.
.
jQueryJMaps–byTanePiper.
11:游戏类jQuery插件
TetriswithjQuery.
jQueryChess.
MadLibsWordGame.
jQueryPuzzle.
jQuerySolarSystem(notagamebutawesomejQueryStuff).
12:表格,网格类jQuery插件
UI/Tablesorter.
jQueryingrid.
jQueryGridPlugin.
TableFilter–awesome!.
TableEditor.
jQueryTreeTables.
Expandable“Detail”TableRows.
.
jQueryBubble.
TableSorter.
ScrollableHTMLTable.
jQuerycolumnManagerPlugin.
jQuerytableHoverPlugin.
jQuerycolumnHoverPlugin.
jQueryGrid.
TableSorterpluginforjQuery.
tEditable–inplacetableeditingforjQuery.
jQuerycharToTablePlugin.
jQueryGridColumnSizing.
jQueryGridRowSizing.
13:统计类jQuery插件
jQueryWizardPlugin.
jQueryChartPlugin.
BarChart.
14:边框、圆角、背景类jQuery插件
jQueryCorner.
jQueryCurvyCorner.
NiftyjQueryCorner.
TransparentCorners.
jQueryCornerGallery.
GradientPlugin.
14:文字和超链接类jQuery插件
jQuerySpoilerplugin.
TextHighlighting.
DisableTextSelectPlugin.
jQueryNewsticker.
Autoline-heightPlugin.
Textgrad–atextgradientplugin.
LinkLook–alinkthumbnailpreview.
pagerjQueryPlugin.
shortKeysjQueryPlugin.
jQueryBiggerlink.
jQueryAjaxLinkChecker.
15:文本提示类jQuery插件
jQueryPlugin–Tooltip.
jTip–ThejQueryToolTip.
clueTip.
BetterTip.
FlashTooltipsusingjQuery.
ToolTip.
16:菜单和导航类jQuery插件
jQueryTabsPlugin–awesome!.[demonestedtabs.]
(basedonjQueryTabsPlugin).
jQueryidTabs.
jdMenu–.
jQuerySuckerFishStyle.
jQueryPluginTreeview.
treeViewBasic.
FastFindMenu.
SlidingMenu.
LavaLampjQueryMenu.
jQueryiconDock.
jVariationsControlPanel.
ContextMenuplugin.
clickMenu.
CSSDockMenu.
jQueryPop-upMenuTutorial.
SlidingMenu.
http://stilbuero.de/jquery/tabs_3/
17:幻灯片、手风琴特效类jQuery插件
jQueryPluginAccordion.
.
haccordion–.
.de.
HoverAccordion.
AccordionExamplefromfmarcia.info.
jQueryAccordionExample.
jQueryDemo–ExpandableSidebarMenu.
SlidingPanelsforjQuery.
jQueryToggleElements.
CodaSlider.
jCarousel.
AccesibleNewsSliderPlugin.
ShowingandHidingcodeExamples.
jQueryEasingPlugin.
jQueryPortlets.
AutoScroll.
Innerfade.
18:拖放类jQuery插件
UI/Draggables.
EasyDragjQueryPlugin.
jQueryPortlets.
jqDnR–drag,dropresize.
DragDemos.
19:XMLXSLJSONFeeds相关jQuery插件
XSLTPlugin.
.
xmlObjectifier–ConvertsXMLDOMtoJSON.
jQueryXSLTransform.
jQueryTaconite–multipleDomupdates.
RSS/ATOMFeedParserPlugin.
jQueryGoogleFeedPlugin.
20:浏览器
Wresize–IEResizeeventFixPlugin.
jQueryifixpng.
jQuerypngFix.
LinkScrubber–.
jQueryPerciformes–.
BackgroundIframe.
QinIE–forproperdisplayofQtagsinIE.
jQueryAccessibilityPlugin.
jQueryMouseWheelPlugin.
21:警告,提示,确认等对话框
jQueryImpromptu.
jQueryConfirmPlugin.
jqModal.
SimpleModal.
CSS
jQueryStyleSwitcher.
JSS–JavascriptStyleSheets.
jQueryRule–creation/manipulationofCSSRules.
jPrintArea.
22:DOM、AJAX和其它JQuery插件
FlyDOM.
jQueryDimenionPlugin.
jQueryLoggin.
Metadata–extractmetadatafromclasses,attributes,elements.
Super-tinyClient-.
UndoMadeEasywithAjax.
JHeartbeat–periodicallypolltheserver.
LazyLoadPlugin.
LiveQuery.
jQueryTimers.
jQueryShareit–displaysocialbookmarkingicons.
jQueryserverCookieJar.
jQueryautoSave.
jQueryPuffer.
jQueryiFramePlugin.
CookiePluginforjQuery.
jQuerySpy–awesomeplugin.
EffectDelayTrick.
jQuick–aquicktagcreatorforjQuery..

⑥ jQuery插件之ajaxFileUpload

ajaxFileUpload是一个异步上传文件的jQuery插件,语法:$.ajaxFileUpload([options])。
使用方法:
第一步:先引入jQuery与ajaxFileUpload插件。注意先后顺序。
<script src="jquery-1.7.1.js" type="text/javascript"></script>
<script src="ajaxfileupload.js" type="text/javascript"></script>

第二步:HTML代码
第三步:JS代码第四步:后台页面upload.aspx代码。

⑦ 求一款jQuery或js多图上传插件

多图上传没问题,但是想上传后可以删除,可以修改名称。这个只能你自己来实现。之前专门写了一个上传插件希望能帮到你

http://blog.csdn.net/sq111433/article/details/16872403

⑧ jquery Uploadify上传文件

Uploadify是JQuery的一个上传插件,实现的效果非常不错,带进度显示。不过官方提供的实例时php版本的,本文将详细介绍Uploadify在Aspnet中的使用,您也可以点击下面的链接进行演示或下载。

首先按下面的步骤来实现一个简单的上传功能。

1 创建Web项目,命名为JQueryUploadDemo,从官网上下载最新的版本解压后添加到项目中。

2 在项目中添加UploadHandler.ashx文件用来处理文件的上传。

3 在项目中添加UploadFile文件夹,用来存放上传的文件。

进行完上面三步后项目的基本结构如下图:

⑨ 谁有jquery的上传插件ajaxupload.3.5.js文件,传到[email protected],谢谢

<script type="text/javascript" src="<?php echo UPLOAD; ?>/js/ajaxupload.3.5.js" ></script>
<link rel="stylesheet" type="text/css" href="<?php echo UPLOAD; ?>/styles.css" />
<script type="text/javascript" >
$(function(){
var btnUpload=$('#upload1');
var status=$('#status1');
new AjaxUpload(btnUpload, {
action: '<?php echo UPLOAD; ?>/upload-image1.php',
name: 'image1',
onSubmit: function(file, ext){
if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){
// extension is not allowed
status.text('仅支持: JPG, PNG 或 GIF 格式');
return false;
}
status.text('上传中...');
},
onComplete: function(file, response){
//On completion clear the status
status.text('');
//Add uploaded file to list
if(response==="success"){
$('<li></li>').appendTo('#files1').html('<img src="<?php echo UPLOAD; ?>/uploads/image/small_image/'+file+'" alt="" /><br /> <input type="text" name="image1" value="<?php echo UPLOAD; ?>/uploads/image/small_image/'+file+'" id="some_name">').addClass('success');
}else if(response==="size_error"){
$('<li></li>').appendTo('#files1').text('建议图片尺寸 : 宽=80px,高=80px ').addClass('error');
} else{
$('<li></li>').appendTo('#files1').text(file).addClass('error');
}
}
});

var btnUpload=$('#upload2');
var status=$('#status2');
new AjaxUpload(btnUpload, {
action: '<?php echo UPLOAD; ?>/upload-image2.php',
name: 'image2',
onSubmit: function(file, ext){
if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){
// extension is not allowed
status.text('仅支持: JPG, PNG 或 GIF 格式');
return false;
}
status.text('上传中...');
},
onComplete: function(file, response){
//On completion clear the status
status.text('');
//Add uploaded file to list
if(response==="success"){
$('<li></li>').appendTo('#files2').html('<img src="<?php echo UPLOAD; ?>/uploads/image/large_image/'+file+'" alt="" /><br /> <input type="text" name="image2" value="<?php echo UPLOAD; ?>/uploads/image/large_image/'+file+'" id="some_name">').addClass('success');
}else if(response==="size_error"){
$('<li></li>').appendTo('#files2').text('正确的图片尺寸是 : 宽=640px,高=358px ').addClass('error');
} else{
$('<li></li>').appendTo('#files2').text(file).addClass('error');
}
}
});

var btnUpload=$('#upload3');
var status=$('#status3');
new AjaxUpload(btnUpload, {
action: '<?php echo UPLOAD; ?>/upload-file.php',
name: 'uploadfile',
onSubmit: function(file, ext){
if (! (ext && /^(zip)$/.test(ext))){
// extension is not allowed
status.html('<div class="error">仅支持zip格式</div>');
return false;
}
status.text('上传中...');
},
onComplete: function(file, response){
//On completion clear the status
status.text('');
//Add uploaded file to list
if(response==="success"){
$('<li></li>').appendTo('#files3').html('<img src="<?php bloginfo('template_url'); ?>/images/icon_zipbox_128.png" alt="" /><br /> <input type="text" name="download_file" value="<?php echo UPLOAD; ?>/uploads/file/'+file+'" id="some_name">').addClass('success');
}else if(response==="size_error"){
$('<li></li>').appendTo('#files3').text('上传文件不应大于 10MB. ').addClass('error');
} else{
$('<li></li>').appendTo('#files3').text(file).addClass('error');
}
}
});
});

$(function(){
$('#main_cat').change(function(){
var $mainCat=$('#main_cat').val();

// call ajax
$("#sub_cat").empty();
$.ajax({
url:"<?php bloginfo('wpurl'); ?>/wp-admin/admin-ajax.php",
type:'POST',
data:'action=my_special_action&main_catid=' + $mainCat,

success:function(results)
{
// alert(results);
$("#sub_cat").removeAttr("disabled");
$("#sub_cat").append(results);
}
});
}
);
});
</script>

⑩ jQuery实现文件上传。

/*jQuery实现文件上传,参考例子如下:
packagecom.kinth.hddpt.file.action;

importjava.io.File;
importjava.io.FileNotFoundException;
importjava.io.FileOutputStream;
importjava.io.IOException;
importjava.io.InputStream;
importjava.io.OutputStream;
importjava.util.ArrayList;
importjava.util.Calendar;
importjava.util.Enumeration;
importjava.util.Hashtable;
importjava.util.List;

importjavax.servlet.http.HttpServletRequest;
importjavax.servlet.http.HttpServletResponse;

importnet.sf.json.JSONArray;

importorg.apache.commons.logging.Log;
importorg.apache.commons.logging.LogFactory;
importorg.apache.struts.action.ActionForm;
importorg.apache.struts.action.ActionForward;
importorg.apache.struts.action.ActionMapping;
importorg.apache.struts.upload.FormFile;
importorg.hibernate.criterion.MatchMode;
importorg.hibernate.criterion.Order;
importorg.hibernate.criterion.Restrictions;

importcom.gdcn.bpaf.common.base.search.MyCriteria;
importcom.gdcn.bpaf.common.base.search.MyCriteriaFactory;
importcom.gdcn.bpaf.common.base.service.BaseService;
importcom.gdcn.bpaf.common.helper.PagerList;
importcom.gdcn.bpaf.common.helper.WebHelper;
importcom.gdcn.bpaf.common.taglib.SplitPage;
importcom.gdcn.bpaf.security.model.LogonVO;
importcom.gdcn.components.appauth.common.helper.DictionaryHelper;
importcom.kinth.common.base.action.BaseAction;
importcom.kinth.hddpt.file.action.form.FileCatalogForm;
importcom.kinth.hddpt.file.model.FileCatalog;
importcom.kinth.hddpt.file.service.FileCatalogService;
importcom.kinth.hddpt.file.util.MyZTreeNode;

/**
*<p>
*description:“文件上传的Struts层请求处理类”
*</p>
*@date:2013-1-14
*/
<FileCatalog>{
@SuppressWarnings("unused")
privatestaticLoglog=LogFactory.getLog(FileCatalogAction.class);//日志记录
;

//删除记录的同时删除相应文件
publicActionForwardfileDelete(ActionMappingmapping,ActionFormform,
HttpServletRequestrequest,HttpServletResponseresponse)
throwsException{
String[]id=request.getParameterValues("resourceId");

if(id!=null&&id[0].contains(",")){
id=id[0].split(",");
}
String[]fileUrls=newString[id.length];
for(intj=0;j<id.length;j++){
fileUrls[j]=fileCatalogService.findObject(id[j]).getFileUrl();
if(!isEmpty(fileUrls[j])){
//如果该文件夹不存在则创建一个uptext文件夹
Filefileup=newFile(fileUrls[j]);
if(fileup.exists()||fileup!=null){
fileup.delete();
}
}

fileCatalogService.deleteObject(id[j]);
}
setAllActionInfos(request);
returnlist(mapping,form,request,response);
}


@Override
publicActionForwardsave(ActionMappingmapping,ActionFormform,
HttpServletRequestrequest,HttpServletResponseresponse)
throwsException{
Stringid=request.getParameter("resourceId");
BooleanfileFlag=Boolean.valueOf(request.getParameter("fileFlag"));

if(fileFlag!=null&&fileFlag==true){
returnsuper.save(mapping,form,request,response);
}else{
StringfileUrl=this.fileUpload(form,request,id,fileFlag);
response.setContentType("text/html");
response.setCharacterEncoding("GBK");
response.setHeader("Charset","GBK");
response.setHeader("Cache-Control","no-cache");
response.getWriter().write(fileUrl);
response.getWriter().flush();
}
returnnull;
}

@SuppressWarnings("unchecked")
publicStringfileUpload(ActionFormform,HttpServletRequestrequest,Stringid,BooleanfileFlag)throwsFileNotFoundException,IOException{

request.setCharacterEncoding("GBK");

StringbasePath=getServlet().getServletConfig().getServletContext().getRealPath("")+"/";
StringfilePath="uploads/";//获取项目根路径;

/*注释部分对应jqueryuploaploadify插件的后台代码,只是还存在编码问题,默认为utf-8
StringsavePath=getServlet().getServletConfig().getServletContext().getRealPath("");//获取项目根路径
savePath=savePath+"\uploads\";
//读取上传来的文件信息
Hashtable<String,FormFile>fileHashtable=form.getMultipartRequestHandler().getFileElements();
Enumeration<String>enumeration=fileHashtable.keys();
enumeration.hasMoreElements();
Stringkey=(String)enumeration.nextElement();

FormFileformFile=(FormFile)fileHashtable.get(key);

Stringfilename=formFile.getFileName().trim();//文件名
filename=newEncodeChange().changeCode(filename);
Stringfiletype=filename.substring(filename.lastIndexOf(".")+1);//文件类型
savePath=savePath+filetype+"\";
System.out.println("path:"+savePath);
StringrealPath=savePath+filename;//真实文件路径

//如果该文件夹不存在则创建一个文件夹
Filefileup=newFile(savePath);
if(!fileup.exists()||fileup==null){
fileup.mkdirs();
}
if(!filename.equals("")){
//在这里上传文件
InputStreamis=formFile.getInputStream();
OutputStreamos=newFileOutputStream(realPath);
intbytesRead=0;
byte[]buffer=newbyte[8192];
while((bytesRead=is.read(buffer,0,8192))!=-1){
os.write(buffer,0,bytesRead);
}
os.close();
is.close();
//如果是修改操作,则删除原来的文件
Stringid=request.getParameter("resourceId");
if(!isEmpty(id)){
FileCatalogfileCatalog=fileCatalogService.findObject(id);
StringfileUrl=fileCatalog.getFileUrl();
if(!isEmpty(fileUrl)){
Filefiledel=newFile(fileUrl);
if(filedel.exists()||filedel!=null){
filedel.delete();
}
}

request.setAttribute("entity",fileCatalog);
}

response.getWriter().print(realPath);//向页面端返回结果信息
}*/

//读取上传来的文件信息
Hashtable<String,FormFile>fileHashtable=form.getMultipartRequestHandler().getFileElements();
Enumeration<String>enumeration=fileHashtable.keys();
enumeration.hasMoreElements();
Stringkey=(String)enumeration.nextElement();

FormFileformFile=(FormFile)fileHashtable.get(key);

Stringfilename=formFile.getFileName().trim();//文件名
Stringfiletype=filename.substring(filename.lastIndexOf(".")+1);//文件类型
IntegerfileSize=formFile.getFileSize();


filePath+=Calendar.getInstance().get(Calendar.YEAR)+"/"+filetype+"/";
StringrealPath=basePath+filePath+filename;//真实文件路径

if(!filename.equals("")){
//如果是修改操作,则删除原来的文件
if(!isEmpty(id)){
FileCatalogfileCatalog=fileCatalogService.findObject(id);
StringfileUrl=fileCatalog.getFileUrl();
if(!isEmpty(fileUrl)){
fileUrl=basePath+fileUrl;
Filefiledel=newFile(fileUrl);
if(filedel.exists()||filedel!=null){
filedel.delete();
}
}
request.setAttribute("entity",fileCatalog);
}
//如果该文件夹不存在则创建一个文件夹
Filefileup=newFile(basePath+filePath);
if(!fileup.exists()||fileup==null){
fileup.mkdirs();
}
//在这里上传文件
InputStreamis=formFile.getInputStream();
OutputStreamos=newFileOutputStream(realPath);
intbytesRead=0;
byte[]buffer=newbyte[8192];
while((bytesRead=is.read(buffer,0,8192))!=-1){
os.write(buffer,0,bytesRead);
}
os.close();
is.close();
}
filePath+=filename;
Stringresult="{"fileName":""+filename+"","fileType":""+filetype+"","fileSize":"+fileSize+","fileUrl":""+filePath+""}";
returnresult;

}

(){
returnfileCatalogService;
}

(){
this.fileCatalogService=fileCatalogService;
}

}

热点内容
ug如何加载服务器 发布:2024-10-11 06:10:40 浏览:566
python3小程序 发布:2024-10-11 06:07:10 浏览:106
数据库无法添加数据 发布:2024-10-11 06:04:16 浏览:744
付费系统源码 发布:2024-10-11 05:42:53 浏览:257
电脑都有哪些配置参数 发布:2024-10-11 05:42:49 浏览:340
ftp耗流量 发布:2024-10-11 05:36:59 浏览:652
c语言输出十六进制数 发布:2024-10-11 05:36:58 浏览:399
Q3X如何重置密码 发布:2024-10-11 05:32:17 浏览:190
iis自带的ftp 发布:2024-10-11 05:32:15 浏览:811
php连接mysql文件 发布:2024-10-11 05:29:00 浏览:861