当前位置:首页 » 文件管理 » 图片上传组件

图片上传组件

发布时间: 2022-01-30 09:41:42

‘壹’ 急求一个图片上传控件

谢谢楼上的回帖,但是你写的这个功能,我可以实现的,关键就是怎么可以在预览中,有一个框,可以调整这个框的大小,只要被这个框选中的区域,点一下确认后,就可以生产一个选中区域的图片,就是校内上传头像的那个控件或者是方法。在这里我还是要感谢一下楼上的代码。谢谢你了啊!!在线等,我很急的啊!!!

‘贰’ 火狐浏览器需要下载什么组件才能看实现富文本编辑器的多张图片上传

多数是调用UEditor的图片上传组件进行图片上传,火狐里开发者相关的扩展太多了,但是使用人数特别多的也就那几种,在火狐扩展中心根据分类,用户数量查看下,然后按需要选择。

‘叁’ 上传图片控件的问题

刚了你的代码,运行了一下,没有发现你说的问题,点击浏览之后,文本框中会保留路径,在点击div后文本框中的值会改变,但不会情空文本框,敢问你用的IE版本是那个,是否是因为存在浏览器兼容性问题

‘肆’ 通过组件上传图片后,怎么得到图片的地址

图片地址=域名+本地保存路径文件名
以http://ewebeditor.webasp.net/Example/I_Upload.asp
那么图片地址就是
http://ewebeditor.webasp.net/本地保存路径文件名(复制框里的内容)

‘伍’ 可以用javascript控制flash图片上传组件进行图片上传吗

不能!flash图片上传那个flash是用actionscription语言写出来的。

‘陆’ asp中上传图片的组件,

4个文件实现无组件上传4个文件实现无组件上传
嵌套式调用:
<iframe name="ad" frameborder=0 width=100% height=50 scrolling=no src=uploada.asp></iframe>

直接链接:uploada.asp
文件保存路径:upload
上传文件类型和大小自己设置

===========================================
第一个文件:inc/confing.asp(inc为文件夹名称)
<%
Const EnableUploadFile="Yes" '是否开放文件上传
Const MaxFileSize=200 '上传文件大小限制
Const UpFileType="gif|jpg|bmp|png|swf|doc|txt|rar|zip" '允许的上传文件类型
%>

===========================================
第二个文件:inc/upload.asp

dim oUpFileStream

Class upload_file

dim Form‚File‚Version

Private Sub Class_Initialize
'定义变量
dim RequestBinDate‚sStart‚bCrLf‚sInfo‚iInfoStart‚iInfoEnd‚tStream‚iStart‚oFileInfo
dim iFileSize‚sFilePath‚sFileType‚sFormvalue‚sFileName
dim iFindStart‚iFindEnd
dim iFormStart‚iFormEnd‚sFormName
'代码开始
Version="无组件上传类 Version 0.96"
set Form = Server.CreateObject("scripting.Dictionary")
set File = Server.CreateObject("scripting.Dictionary")
if Request.TotalBytes < 1 then Exit Sub
set tStream = Server.CreateObject("adodb.stream")
set oUpFileStream = Server.CreateObject("adodb.stream")
oUpFileStream.Type = 1
oUpFileStream.Mode = 3
oUpFileStream.Open
oUpFileStream.Write Request.BinaryRead(Request.TotalBytes)
oUpFileStream.Position=0
RequestBinDate = oUpFileStream.Read
iFormEnd = oUpFileStream.Size
bCrLf = chrB(13) & chrB(10)
'取得每个项目之间的分隔符
sStart = MidB(RequestBinDate‚1‚ InStrB(1‚RequestBinDate‚bCrLf)-1)
iStart = LenB (sStart)
iFormStart = iStart+2
'分解项目
Do
iInfoEnd = InStrB(iFormStart‚RequestBinDate‚bCrLf & bCrLf)+3
tStream.Type = 1
tStream.Mode = 3
tStream.Open
oUpFileStream.Position = iFormStart
oUpFileStream.CopyTo tStream‚iInfoEnd-iFormStart
tStream.Position = 0
tStream.Type = 2
tStream.Charset ="gb2312"
sInfo = tStream.ReadText
'取得表单项目名称
iFormStart = InStrB(iInfoEnd‚RequestBinDate‚sStart)-1
iFindStart = InStr(22‚sInfo‚"name="""‚1)+6
iFindEnd = InStr(iFindStart‚sInfo‚""""‚1)
sFormName = Mid (sinfo‚iFindStart‚iFindEnd-iFindStart)
'如果是文件
if InStr (45‚sInfo‚"filename="""‚1) > 0 then
set oFileInfo= new FileInfo
'取得文件属性
iFindStart = InStr(iFindEnd‚sInfo‚"filename="""‚1)+10
iFindEnd = InStr(iFindStart‚sInfo‚""""‚1)
sFileName = Mid (sinfo‚iFindStart‚iFindEnd-iFindStart)
oFileInfo.FileName = GetFileName(sFileName)
oFileInfo.FilePath = GetFilePath(sFileName)
oFileInfo.FileExt = GetFileExt(sFileName)
iFindStart = InStr(iFindEnd‚sInfo‚"Content-Type: "‚1)+14
iFindEnd = InStr(iFindStart‚sInfo‚vbCr)
oFileInfo.FileType = Mid (sinfo‚iFindStart‚iFindEnd-iFindStart)
oFileInfo.FileStart = iInfoEnd
oFileInfo.FileSize = iFormStart -iInfoEnd -2
oFileInfo.FormName = sFormName
file.add sFormName‚oFileInfo
else
'如果是表单项目
tStream.Close
tStream.Type = 1
tStream.Mode = 3
tStream.Open
oUpFileStream.Position = iInfoEnd
oUpFileStream.CopyTo tStream‚iFormStart-iInfoEnd-2
tStream.Position = 0
tStream.Type = 2
tStream.Charset = "gb2312"
sFormvalue = tStream.ReadText
form.Add sFormName‚sFormvalue
end if
tStream.Close
iFormStart = iFormStart+iStart+2
'如果到文件尾了就退出
loop until (iFormStart+2) = iFormEnd
RequestBinDate=""
set tStream = nothing
End Sub

Private Sub Class_Terminate
'清除变量及对像
if not Request.TotalBytes<1 then
oUpFileStream.Close
set oUpFileStream =nothing
end if
Form.RemoveAll
File.RemoveAll
set Form=nothing
set File=nothing
End Sub

'取得文件路径
Private function GetFilePath(FullPath)
If FullPath <> "" Then
GetFilePath = left(FullPath‚InStrRev(FullPath‚ "\"))
Else
GetFilePath = ""
End If
End function

'取得文件名
Private function GetFileName(FullPath)
If FullPath <> "" Then
GetFileName = mid(FullPath‚InStrRev(FullPath‚ "\")+1)
Else
GetFileName = ""
End If
End function

'取得扩展名
Private function GetFileExt(FullPath)
If FullPath <> "" Then
GetFileExt = mid(FullPath‚InStrRev(FullPath‚ ".")+1)
Else
GetFileExt = ""
End If
End function

End Class

'文件属性类
Class FileInfo
dim FormName‚FileName‚FilePath‚FileSize‚FileType‚FileStart‚FileExt
Private Sub Class_Initialize
FileName = ""
FilePath = ""
FileSize = 0
FileStart= 0
FormName = ""
FileType = ""
FileExt = ""
End Sub

'保存文件方法
Public function SaveToFile(FullPath)
dim oFileStream‚ErrorChar‚i
SaveToFile=1
if trim(fullpath)="" or right(fullpath‚1)="/" then exit function
set oFileStream=CreateObject("Adodb.Stream")
oFileStream.Type=1
oFileStream.Mode=3
oFileStream.Open
oUpFileStream.position=FileStart
oUpFileStream.to oFileStream‚FileSize
oFileStream.SaveToFile FullPath‚2
oFileStream.Close
set oFileStream=nothing
SaveToFile=0
end function
End Class
%>

========================================
第三个文件:uploada.asp

<!--#include file="Inc/config.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
BODY{
BACKGROUND-COLOR: #f5feed;
font-size:9pt
}
.tx1 { height: 20px;font-size: 9pt; border: 1px solid; border-color: #000000; color: #0000FF}
-->
</style>
<link href="Manage/Inc/ManageMent.css" rel="stylesheet" type="text/css">
</head>
<body leftmargin="0" topmargin="0">
<%
if EnableUploadFile="Yes" then
%>
<form action="upfilea.asp" method="post" name="form1" enctype="multipart/form-data">
<input name="FileName" type="FILE" class="tx1" size="20">
<input type="submit" name="Submit" value="上传" style="border:1px double rgb(88‚88‚88);font:9pt">
</form>
<%
end if
%>
</body>
</html>

============================
第四个文件:upfilea.asp

<!--#include file="Inc/config.asp"-->
<!--#include file="Inc/upload.asp"-->
<%
const upload_type=0 '上传方法:0=无惧无组件上传类,1=FSO上传 2=lyfupload,3=aspupload,4=chinaaspupload

dim upload‚file‚formName‚SavePath‚filename‚fileExt
dim upNum
dim EnableUpload
dim Forumupload
dim ranNum
dim uploadfiletype
dim msg‚founderr
msg=""
founderr=false
EnableUpload=false
SavePath = "Upload" '存放上传文件的目录
if right(SavePath‚1)<>"/" then SavePath=SavePath&"/" '在目录后加(/)
%>
<%
ComeinSTR=lcase(request.servervariables("HTTP_HOST"))
Url=split(ComeinSTR)
yourthing=Url(0)
%>
<html>
<head>
<link href="Manage/Inc/ManageMent.css" rel="stylesheet" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<%
if EnableUploadFile="NO" then
response.write "系统未开放文件上传功能"
else

select case upload_type
case 0
call upload_0() '使用化境无组件上传类
case else

end select

end if
%>
</body>
</html>
<%
sub upload_0() '使用化境无组件上传类
set upload=new upload_file '建立上传对象
for each formName in upload.file '列出所有上传了的文件
set file=upload.file(formName) '生成一个文件对象
if file.filesize<100 then
msg="请先选择你要上传的文件!"
founderr=true
end if
if file.filesize>(MaxFileSize*1024) then
msg="文件大小超过了限制,最大只能上传" & CStr(MaxFileSize) & "K的文件!"
founderr=true
end if

fileExt=lcase(file.FileExt)
Forumupload=split(UpFileType‚"|")
for i=0 to ubound(Forumupload)
if fileEXT=trim(Forumupload(i)) then
EnableUpload=true
exit for
end if
next
if fileEXT="asp" or fileEXT="asa" or fileEXT="aspx" then
EnableUpload=false
end if
if EnableUpload=false then
'msg="这种文件类型不允许上传!\n\n只允许上传这几种文件类型:" & UpFileType
response.write"<script language=javascript>alert('这种文件类型不允许上传!\n\n只允许上传这几种文件类型:" &

UpFileType & "');"
response.write"javascript:history.go(-1)</script>"
founderr=true
end if

strJS="<script language=javascript>" & vbcrlf
if founderr<>true then
randomize
ranNum=int(900*rnd)+100
filename=SavePath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&ranNum&"."&fileExt

file.SaveToFile Server.mappath(FileName) '保存文件

msg="上传文件成功!"

FileType=right(fileExt‚3)
select case FileType
case "jpg"‚"gif"‚"png"‚"bmp"
case "swf"
case else
strJS=strJS & "range.text=' 点击浏览该文件';" & vbcrlf
end select
end if
strJS=strJS & "alert('" & msg & "');" & vbcrlf

strJS=strJS & "</script>"
response.write strJS
response.write "图片上传成功!文件路径是 /" & filename & "<br>"
response.write "http://";; & yourthing & "/" & filename & "<br>"
set file=nothing
next
set upload=nothing
end sub
%>

‘柒’ 跪求使用smartupload组件实现图片上传的最简单的jsp代码

<%@ page contentType="text/html; charset=gbk" language="java" errorPage="" %>
<jsp:directive.page import="org.lxh.smart.SmartUpload"/>
<jsp:directive.page import="java.io.File"/>
<jsp:directive.page import="org.lxh.smart.Files"/>
<jsp:directive.page import="com..PathDao"/>
<jsp:directive.page import="com.entity.Photo"/>
<jsp:directive.page import="java.util.List"/>
<jsp:directive.page import="java.util.ArrayList"/>
<jsp:directive.page import="com..PhotoDao"/>
<jsp:directive.page import="com.impl.PhotoDaoImpl"/>
<%
int albumId=8;
int uId=Integer.parseInt(session.getAttribute("user").toString());
List<Photo> listPhoto=new ArrayList<Photo>();
// 新建一个SmartUpload对象
SmartUpload su = new SmartUpload();
try{
// 上传初始化
su.initialize(pageContext);
// 设定上传限制
// 1.限制每个上传文件的最大长度。
//su.setMaxFileSize(10000);
// 2.限制总上传数据的长度。
//su.setTotalMaxFileSize(20000);
// 3.设定允许上传的文件(通过扩展名限制)。
//su.setAllowedFilesList("gif,jpg,png,GIF,JPG,PNG");
// 4.设定禁止上传的文件(通过扩展名限制),禁止上传带有exe,bat,
//jsp,htm,html扩展名的文件和没有扩展名的文件。
//su.setDeniedFilesList("exe,bat,jsp,htm,html,,");
// 上传文件
su.upload();
// 将上传文件全部保存到指定目录
String temp="/upload/images/"+session.getAttribute("user");
//创建文件夹使用绝对路径
String uploadPath =request.getRealPath("/")+temp;
if(!new File(uploadPath).isDirectory())
new File(uploadPath).mkdirs();
Files files=su.getFiles();
for(int i=0;i<files.getCount();i++){
org.lxh.smart.File file=files.getFile(i);
if(file.isMissing()){break;}
if(i>1){
if(file==files.getFile(i-1)){
continue;
}
if(i>2){
if(file==files.getFile(i-2)){
continue;
}
}
if(i>3){
if(file==files.getFile(i-3)){
continue;
}
}
}
PathDao pathDao=new PathDao();//这个类里面实现一个getFileName方法,根据当前时间得到图片名称
String postfix="."+file.getFileExt();
//这个就是可以得到图片的路径了
String strtemp=uploadPath+"/"+pathDao.getFileName()+postfix;
file.saveAs(strtemp);
}
%>
<script>
alert("图片上传成功!");
</script>
<%
}catch (Exception e){
System.out.println(e.getMessage());
%>
<script>
alert("图片上传失败!");
history.go(-1);
</script>
<%
}finally{
%>
<script>location="toYours.jsp?name=album.jsp";</script>
<%
}
%>

------------jsp页面--------
<FORM METHOD="POST" ACTION="do_uploadPhotos.jsp"
ENCTYPE="multipart/form-data" name="uploadPhotoForm"
onSubmit="return check()">
<table width="75%" border="1" align="center">
<tr>
<td>
<div align="center">
1、
<input type="FILE" name="FILE1" size="30">
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
2、
<input type="FILE" name="FILE2" size="30">
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
3、
<input type="FILE" name="FILE3" size="30">
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
4、
<input type="FILE" name="FILE4" size="30">
</div>
</td>
</tr>
<tr>
<td>
<div align="center">
<input type="submit" name="Submit1" value="上传图片">
</div>
</td>
</tr>
</table>

</FORM>

‘捌’ 上传图片组件问题

太难了!不明白什么意思!

‘玖’ 图片上传插件!!!已经 滚动条!!!

搜一下Xproer.ImageUploader,这个是一个100%仿QQ空间中的图片上传控件。

热点内容
西门子编程代码 发布:2024-10-20 09:19:00 浏览:261
计算器代码java 发布:2024-10-20 09:18:54 浏览:986
哈弗h2哪个配置有天窗 发布:2024-10-20 09:17:17 浏览:807
ftp每隔5分钟就断一次连接 发布:2024-10-20 09:09:43 浏览:483
私有云盘源码 发布:2024-10-20 09:08:15 浏览:478
电脑的上传速度怎么调 发布:2024-10-20 09:01:18 浏览:872
我的世界服务器淬炼要多少钱 发布:2024-10-20 08:54:10 浏览:952
云服务器生产环境搭建 发布:2024-10-20 08:48:47 浏览:102
堆存储和堆 发布:2024-10-20 08:48:09 浏览:882
哪里能买到密码机 发布:2024-10-20 08:43:25 浏览:245