asp上传单个图片的最简单代码是什么?

作者&投稿:驷竹 (若有异议请与网页底部的电邮联系)
ASP上传图片代码,最简单的~

无惧无组件上传:
这是放到前面让选择图片的代码和上传按钮




这是Upfile_ProductPic.asp文件,修改下存储路径和数据表




<%
picname=Requesta("Act")
const upload_type=0 '上传方法:0=无惧无组件上传类,1=FSO上传 2=lyfupload,3=aspupload,4=chinaaspupload
'const SaveUpProductPicPath="UploadProductPic"
'const UpProductPicType="jpg|gif|png|bmp"
'const MaxProductPicSize=20480000

dim upload,oFile,formName,SavePath,FileName,fileExt,oFileSize
dim EnableUpload
dim arrUpFileType
dim ranNum
dim msg,FoundErr
msg=""
FoundErr=false
EnableUpload=false
SavePath = "upfiles/" '存放上传文件的目录
%>






<%
if EnableUploadFile="No" then
response.write "系统未开放文件上传功能"
else

select case upload_type
case 0
call upload_0() '使用化境无组件上传类
case else
'response.write "本系统未开放插件功能"
'response.end
end select

end if
%>


<%
sub upload_0() '使用化境无组件上传类
set upload=new upfile_class ''建立上传对象
upload.GetData(20480000) '取得上传数据,限制最大上传500K
if upload.err > 0 then '如果出错
select case upload.err
case 1
response.write "请先选择你要上传的文件!"
case 2
response.write "你上传的文件总大小超出了最大限制(20M)"
end select
response.end
end if

for each formName in upload.file '列出所有上传了的文件
EnableUpload=False
set ofile=upload.file(formName) '生成一个文件对象
oFileSize=ofile.filesize
if oFileSize<10 then
msg="请先选择你要上传的文件!!"
FoundErr=True
elseif ofilesize>(MaxProductPicSize*1024) then
msg="文件大小超过了限制,最大只能上传" & CStr(MaxProductPicSize) & "K的文件!"
FoundErr=true
end if

fileExt=lcase(ofile.FileExt)
arrUpFileType=split(UpProductPicType,"|")
for i=0 to ubound(arrUpFileType)
if fileEXT=trim(arrUpFileType(i)) then
EnableUpload=true
exit for
end if
next
if fileEXT="asp" or fileEXT="asa" or fileEXT="aspx" or fileEXT="cer" or fileEXT="cdx" then
EnableUpload=false
end if
if EnableUpload=false then
msg="这种文件类型不允许上传!

只允许上传这几种文件类型:" & UpProductPicType
FoundErr=true
end if


strJS="" & vbcrlf
if FoundErrtrue then
randomize
ranNum=int(900*rnd)+100
FileName="../../"&SavePath&picname&"."&fileExt

ofile.SaveToFile Server.mappath(FileName) '保存文件
conn.open constr
sql="update indexPic set p_picture='"&picname&"."&fileExt&"' where p_name='"&picname&"'"
conn.execute(sql)
conn.close
Alert_reDirect "上传成功!","indexPic.asp"


end if
next
set upload=nothing
end sub
%>



这是upfile_class.asp文件,不用更改。
<%

Dim oUpFileStream
'----------------------------------------------------------------------
'文件上传类
Class UpFile_Class

Dim Form,File,Version,Err

Private Sub Class_Initialize
Version = "无惧上传类 Version V1.2"
Err = -1
End Sub

Private Sub Class_Terminate
'清除变量及对像
If Err < 0 Then
Form.RemoveAll
Set Form = Nothing
File.RemoveAll
Set File = Nothing
oUpFileStream.Close
Set oUpFileStream = Nothing
End If
End Sub

Public Sub GetData (MaxSize)
'定义变量
Dim RequestBinDate,sSpace,bCrLf,sInfo,iInfoStart,iInfoEnd,tStream,iStart,oFileInfo
Dim iFileSize,sFilePath,sFileType,sFormValue,sFileName
Dim iFindStart,iFindEnd
Dim iFormStart,iFormEnd,sFormName
'代码开始
If Request.TotalBytes < 1 Then '如果没有数据上传
Err = 1
Exit Sub
End If
If MaxSize > 0 Then '如果限制大小
If Request.TotalBytes > MaxSize Then
Err = 2 '如果上传的数据超出限制
Exit Sub
End If
End If
Set Form = Server.CreateObject ("Scripting.Dictionary")
Form.CompareMode = 1
Set File = Server.CreateObject ("Scripting.Dictionary")
File.CompareMode = 1
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)
'取得每个项目之间的分隔符
sSpace = MidB (RequestBinDate,1, InStrB (1,RequestBinDate,bCrLf)-1)
iStart = LenB (sSpace)
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,sSpace)-1
iFindStart = InStr (22,sInfo,"name=""",1)+6
iFindEnd = InStr (iFindStart,sInfo,"""",1)
sFormName = Trim(Mid (sinfo,iFindStart,iFindEnd-iFindStart))
'如果是文件
If InStr (45,sInfo,"filename=""",1) > 0 Then
Set oFileInfo = new FileInfo_Class
'取得文件属性
iFindStart = InStr (iFindEnd,sInfo,"filename=""",1)+10
iFindEnd = InStr (iFindStart,sInfo,"""",1)
sFileName = Trim(Mid(sinfo,iFindStart,iFindEnd-iFindStart))
oFileInfo.FileName = Mid (sFileName,InStrRev (sFileName, "\")+1)
oFileInfo.FilePath = Left (sFileName,InStrRev (sFileName, "\"))
oFileInfo.FileExt = Mid (sFileName,InStrRev (sFileName, ".")+1)
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
If Form.Exists (sFormName) Then
Form (sFormName) = Form (sFormName) & ", " & sFormValue
else
form.Add sFormName,sFormValue
End If
End If
tStream.Close
iFormStart = iFormStart+iStart+2
'如果到文件尾了就退出
Loop Until (iFormStart+2) >= iFormEnd
RequestBinDate = ""
Set tStream = Nothing
End Sub
End Class

'----------------------------------------------------------------------------------------------------
'文件属性类
Class FileInfo_Class
Dim FormName,FileName,FilePath,FileSize,FileType,FileStart,FileExt
'保存文件方法
Public Function SaveToFile (Path)
if lcase((right(Path,3))lcase(FileExt)) then '经典的上传漏洞^_^
response.Write ("alert('警告:不允许上传这种文件!');")
response.end
end if
On Error Resume Next
Dim oFileStream
Set oFileStream = CreateObject ("ADODB.Stream")
oFileStream.Type = 1
oFileStream.Mode = 3
oFileStream.Open
oUpFileStream.Position = FileStart
oUpFileStream.CopyTo oFileStream,FileSize
oFileStream.SaveToFile Path,2
oFileStream.Close
Set oFileStream = Nothing
End Function

'取得文件数据
Public Function FileData
oUpFileStream.Position = FileStart
FileData = oUpFileStream.Read (FileSize)
End Function

End Class


'**************************************************
'函数名:IsObjInstalled
'作 用:检查组件是否已经安装
'参 数:strClassString ----组件名
'返回值:True ----已经安装
' False ----没有安装
'**************************************************
Function IsObjInstalled(strClassString)
On Error Resume Next
IsObjInstalled = False
Err = 0
Dim xTestObj
Set xTestObj = Server.CreateObject(strClassString)
If 0 = Err Then IsObjInstalled = True
Set xTestObj = Nothing
Err = 0
End Function
'-------------根据指定名称生成目录---------
Function MakeNewsDir(foldername)
dim fso,f
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set f = fso.CreateFolder(foldername)
MakeNewsDir = True
Set fso = nothing
End Function

%>

upfile.asp 上传的图片存到images/upfile文件夹下。



<%
if Request("menu")="up" then
On Error Resume Next
Set upl = Server.CreateObject("SoftArtisans.FileUp")
If -2147221005 = Err Then
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

set FileUP=new Upload_file

FileUP.GetDate(-1)
formPath="images/upfile/"
set file=FileUP.file("file")
filename=formPath&year(now)&month(now)&day(now)&hour(now)&minute(now)&second(now)&"."&file.FileExt


select case LCase(file.FileExt)
case "gif"
img="[img]"&cluburl&"/"&filename&"[/img]"
case "jpg"
img="[img]"&cluburl&"/"&filename&"[/img]"
case "swf"
img="[flash]"&cluburl&"/"&filename&"[/flash]"
case else
error2("Sorry ,this local server only supports GIF , JPG and SWF format of files
does not support "&file.FileExt&" format of files")
end select

file.SaveToFile Server.mappath(filename)

set FileUP=nothing
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''


else


filename=""&year(date)&""&month(date)&""&day(date)&""&hour(time)&""&minute(time)&""&second(time)&""
select case ""&upl.ContentType&""
case "application/octet-stream"
error2("Unknown file format!")
case "image/gif"
types="gif"
case "image/pjpeg"
types="jpg"
case "application/x-shockwave-flash"
types="swf"
end select

filename="images/upfile/"&filename&"."&types&""


if types="gif" or types="jpg" then
img="[img]"&cluburl&"/"&filename&"[/img]"

elseif types="swf" then
img="[flash]"&cluburl&"/"&filename&"[/flash]"

else
error2("Sorry ,this local server only supports GIF , JPG and SWF format of files
does not support "&upl.ContentType&"format of files")
end if


upl.SaveAs Server.mappath(""&filename&"")

set upl=nothing



End If


response.write "parent.myform.pic.value='admin/"&filename&"'"
responseend

else

%>






<%

end if
%>

需要三个文件:
第一个(upload.asp)
<% Response.Buffer=True %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<title>图片上传</title>
</head>
<body background="images/bg.gif" topmargin="30" style=""><div align="center">
<center>
<table border="1" cellspacing="1" style="border-collapse: collapse" bordercolor="#C0C0C0" width="420" id="AutoNumber69" bgcolor="#F5F5F5">
<tr>
<td width="100%" bgcolor="#F5F5F5" bordercolor="#F5F5F5"><form name="form1" method="post" action="uploadsave.asp" enctype="multipart/form-data">
<p align="center"><span style="font-size: 12px">图片上传:</span><br>
<br>
 
<input type="file" class="f11" name="file1" size="23">
<br>
<br>
<input type=submit name="submit" value="上 传" class=anniu >
<br>
<br>
<span style="font-size: 12px">文件格式为<font color="#EC5106">*.gif,*.jpg,*.jpeg
</font></span></p>
</form></td>
</tr>
</table>
</center>
</body>
</html>
第二个文件(uploadsave.asp)
<% Response.Buffer=True %>

<html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>图片上传</title>

</head>

<body topmargin="20">
<!--#include FILE="upload_asjob.asp"-->
<%
set upload=new upload_5xsoft
set file=upload.file("file1")
if file.fileSize>0 then
'自动生成文件名
filename=date()
filename=filename&time()
filename=replace(filename,"-","")
filename=replace(filename,":","")
filename=replace(filename," ","")
filename=filename+"."
filenameend=file.filename
filenameend=split(filenameend,".")
if filenameend(1)="gif" or filenameend(1)="jpg" or filenameend(1)="jpeg" then
filename=filename&filenameend(1)
file.saveAs Server.mappath("uppic/"&filename)
response.write "<p align=center>"
response.write "图片已成功上传至服务器中,请使用下面红色地址添加图片,<br><p align=center><a href=upload.asp>点击这里重新上传图片!</a>"
response.write "</p>"
response.write "<p align=center>"
response.write "<font color=red>"
response.write "asjobcom/uppic/"&filename
response.write "</font></p>"
response.write "<p align=center>"
response.write "<a href='uppic/"&filename&"' target=_blank>点击这里查看上传的图片</a>"
response.write "</p>"
response.write "<p align=center><a href=javascript:window.close()>【关闭窗口】</a>"
else
response.write "文件格式不对"
response.write "<a href=upload.asp>返回"
end if
set file=nothing
else
response.write "文件内容不能为空"
response.write "<a href=upload.asp>返回"
end if
set upload=nothing
response.write "<br>"
%>
最后一个(upload_asjob.asp)
<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>

dim upfile_5xSoft_Stream

Class upload_5xSoft

dim Form,File,Version

Private Sub Class_Initialize
dim iStart,iFileNameStart,iFileNameEnd,iEnd,vbEnter,iFormStart,iFormEnd,theFile
dim strDiv,mFormName,mFormValue,mFileName,mFileSize,mFilePath,iDivLen,mStr
Version="化境编程界HTTP上传程序 Version 1.0"
if Request.TotalBytes<1 then Exit Sub
set Form=CreateObject("Scripting.Dictionary")
set File=CreateObject("Scripting.Dictionary")
set upfile_5xSoft_Stream=CreateObject("Adodb.Stream")
upfile_5xSoft_Stream.mode=3
upfile_5xSoft_Stream.type=1
upfile_5xSoft_Stream.open
upfile_5xSoft_Stream.write Request.BinaryRead(Request.TotalBytes)

vbEnter=Chr(13)&Chr(10)
iDivLen=inString(1,vbEnter)+1
strDiv=subString(1,iDivLen)
iFormStart=iDivLen
iFormEnd=inString(iformStart,strDiv)-1
while iFormStart < iFormEnd
iStart=inString(iFormStart,"name=""")
iEnd=inString(iStart+6,"""")
mFormName=subString(iStart+6,iEnd-iStart-6)
iFileNameStart=inString(iEnd+1,"filename=""")
if iFileNameStart>0 and iFileNameStart<iFormEnd then
iFileNameEnd=inString(iFileNameStart+10,"""")
mFileName=subString(iFileNameStart+10,iFileNameEnd-iFileNameStart-10)
iStart=inString(iFileNameEnd+1,vbEnter&vbEnter)
iEnd=inString(iStart+4,vbEnter&strDiv)
if iEnd>iStart then
mFileSize=iEnd-iStart-4
else
mFileSize=0
end if
set theFile=new FileInfo
theFile.FileName=getFileName(mFileName)
theFile.FilePath=getFilePath(mFileName)
theFile.FileSize=mFileSize
theFile.FileStart=iStart+4
theFile.FormName=FormName
file.add mFormName,theFile
else
iStart=inString(iEnd+1,vbEnter&vbEnter)
iEnd=inString(iStart+4,vbEnter&strDiv)

if iEnd>iStart then
mFormValue=subString(iStart+4,iEnd-iStart-4)
else
mFormValue=""
end if
form.Add mFormName,mFormValue
end if

iFormStart=iformEnd+iDivLen
iFormEnd=inString(iformStart,strDiv)-1
wend
End Sub

Private Function subString(theStart,theLen)
dim i,c,stemp
upfile_5xSoft_Stream.Position=theStart-1
stemp=""
for i=1 to theLen
if upfile_5xSoft_Stream.EOS then Exit for
c=ascB(upfile_5xSoft_Stream.Read(1))
If c > 127 Then
if upfile_5xSoft_Stream.EOS then Exit for
stemp=stemp&Chr(AscW(ChrB(AscB(upfile_5xSoft_Stream.Read(1)))&ChrB(c)))
i=i+1
else
stemp=stemp&Chr(c)
End If
Next
subString=stemp
End function

Private Function inString(theStart,varStr)
dim i,j,bt,theLen,str
InString=0
Str=toByte(varStr)
theLen=LenB(Str)
for i=theStart to upfile_5xSoft_Stream.Size-theLen
if i>upfile_5xSoft_Stream.size then exit Function
upfile_5xSoft_Stream.Position=i-1
if AscB(upfile_5xSoft_Stream.Read(1))=AscB(midB(Str,1)) then
InString=i
for j=2 to theLen
if upfile_5xSoft_Stream.EOS then
inString=0
Exit for
end if
if AscB(upfile_5xSoft_Stream.Read(1))<>AscB(MidB(Str,j,1)) then
InString=0
Exit For
end if
next
if InString<>0 then Exit Function
end if
next
End Function

Private Sub Class_Terminate
form.RemoveAll
file.RemoveAll
set form=nothing
set file=nothing
upfile_5xSoft_Stream.close
set upfile_5xSoft_Stream=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 toByte(Str)
dim i,iCode,c,iLow,iHigh
toByte=""
For i=1 To Len(Str)
c=mid(Str,i,1)
iCode =Asc(c)
If iCode<0 Then iCode = iCode + 65535
If iCode>255 Then
iLow = Left(Hex(Asc(c)),2)
iHigh =Right(Hex(Asc(c)),2)
toByte = toByte & chrB("&H"&iLow) & chrB("&H"&iHigh)
Else
toByte = toByte & chrB(AscB(c))
End If
Next
End function
End Class

Class FileInfo
dim FormName,FileName,FilePath,FileSize,FileStart
Private Sub Class_Initialize
FileName = ""
FilePath = ""
FileSize = 0
FileStart= 0
FormName = ""
End Sub

Public function SaveAs(FullPath)
dim dr,ErrorChar,i
SaveAs=1
if trim(fullpath)="" or FileSize=0 or FileStart=0 or FileName="" then exit function
if FileStart=0 or right(fullpath,1)="/" then exit function
set dr=CreateObject("Adodb.Stream")
dr.Mode=3
dr.Type=1
dr.Open
upfile_5xSoft_Stream.position=FileStart-1
upfile_5xSoft_Stream.copyto dr,FileSize
dr.SaveToFile FullPath,2
dr.Close
set dr=nothing
SaveAs=0
end function
End Class
</SCRIPT>

那就select top 1 图片表列1 from 表 where 。。。。orde by desc
从数据库只读取一个最新信息咯

果断给分.

<%
Response.Buffer = True
Server.ScriptTimeOut=9999999
On Error Resume Next
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta http-equiv="Content-Language" content="zh-cn" />
<meta content="all" name="robots" />
<meta name="author" content="木目,Woodeye" />
<meta name="description" content="木目ASP文件上传工具" />
<meta name="keywords" content="木目,ASP,Upload,文件上传" />
<style type="text/css">
<!--
body,input {font-size:12px;}
-->
</style>
<title>木目ASP文件上传工具</title>
</head>
<body id="body">
<%
ExtName = "jpg,gif,png,txt,rar,zip,doc,bmp" '允许扩展名
SavePath = "image" '保存路径
If Right(SavePath,1)<>"/" Then SavePath=SavePath&"/" '在目录后加(/)
CheckAndCreateFolder(SavePath)

UpLoadAll_a = Request.TotalBytes '取得客户端全部内容
If(UpLoadAll_a>0) Then
Set UploadStream_c = Server.CreateObject("ADODB.Stream")
UploadStream_c.Type = 1
UploadStream_c.Open
UploadStream_c.Write Request.BinaryRead(UpLoadAll_a)
UploadStream_c.Position = 0

FormDataAll_d = UploadStream_c.Read
CrLf_e = chrB(13)&chrB(10)
FormStart_f = InStrB(FormDataAll_d,CrLf_e)
FormEnd_g = InStrB(FormStart_f+1,FormDataAll_d,CrLf_e)

Set FormStream_h = Server.Createobject("ADODB.Stream")
FormStream_h.Type = 1
FormStream_h.Open
UploadStream_c.Position = FormStart_f + 1
UploadStream_c.CopyTo FormStream_h,FormEnd_g-FormStart_f-3
FormStream_h.Position = 0
FormStream_h.Type = 2
FormStream_h.CharSet = "GB2312"
FormStreamText_i = FormStream_h.Readtext
FormStream_h.Close

FileName_j = Mid(FormStreamText_i,InstrRev(FormStreamText_i,"\")+1,FormEnd_g)

If(CheckFileExt(FileName_j,ExtName)) Then
SaveFile = Server.MapPath(SavePath & FileName_j)

If Err Then
Response.Write "文件上传: <span style=""color:red;"">文件上传出错!</span> <a href=""" & Request.ServerVariables("URL") &""">重新上传文件</a><br />"
Err.Clear
Else
SaveFile = CheckFileExists(SaveFile)

k=Instrb(FormDataAll_d,CrLf_e&CrLf_e)+4
l=Instrb(k+1,FormDataAll_d,leftB(FormDataAll_d,FormStart_f-1))-k-2
FormStream_h.Type=1
FormStream_h.Open
UploadStream_c.Position=k-1
UploadStream_c.CopyTo FormStream_h,l
FormStream_h.SaveToFile SaveFile,2

SaveFileName = Mid(SaveFile,InstrRev(SaveFile,"\")+1)
Response.write "文件上传: <span style=""color:red;"">" & SaveFileName & " </span>文件上传成功! <a href=""" & Request.ServerVariables("URL") &""">继续上传文件</a><br />"
End If
Else
Response.write "文件上传: <span style=""color:red;"">文件格式不正确!</span> <a href=""" & Request.ServerVariables("URL") &""">重新上传文件</a><br />"
End If

Else
%>
<script language="Javascript">
<!--
function ValidInput()
{

if(document.upform.upfile.value=="")
{
alert("请选择上传文件!")
document.upform.upfile.focus()
return false
}
return true
}
// -->
</script>
<form action='<%= Request.ServerVariables("URL") %>' method='post' name="upform" onsubmit="return ValidInput()" enctype="multipart/form-data">
文件上传:
<input type='file' name='upfile' size="40"> <input type='submit' value="上传">
</form>
<%
End if
Set FormStream_h = Nothing
UploadStream.Close
Set UploadStream = Nothing
%>
</body>
</html>
<%
'判断文件类型是否合格
Function CheckFileExt(FileName,ExtName) '文件名,允许上传文件类型
FileType = ExtName
FileType = Split(FileType,",")
For i = 0 To Ubound(FileType)
If LCase(Right(FileName,3)) = LCase(FileType(i)) then
CheckFileExt = True
Exit Function
Else
CheckFileExt = False
End if
Next
End Function

'检查上传文件夹是否存在,不存在则创建文件夹
Function CheckAndCreateFolder(FolderName)
fldr = Server.Mappath(FolderName)
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists(fldr) Then
fso.CreateFolder(fldr)
End If
Set fso = Nothing
End Function

'检查文件是否存在,重命名存在文件
Function CheckFileExists(FileName)
Set fso=Server.CreateObject("Scripting.FileSystemObject")
If fso.FileExists(SaveFile) Then
i=1
msg=True
Do While msg
CheckFileExists = Replace(SaveFile,Right(SaveFile,4),"_" & i & Right(SaveFile,4))
If not fso.FileExists(CheckFileExists) Then
msg=False
End If
i=i+1
Loop
Else
CheckFileExists = FileName
End If
Set fso=Nothing
End Function
%>

用Dreamweaver直接把图片设计在里边不就行了


苹果6sp怎么从电脑上传照片?
1、首先将iPhone6连接电脑 2、在计算机下,会出现iPhone6的盘符 3、打开iPhone6的盘符,可以看到很多的文件夹,这些文件夹内就是iPhone中拍摄的照片 4、如果要将照片快速导出到电脑,可以右击iPhone的盘符,选择【导入图片和视频】5、点击【导入设置】,可以选择导入电脑的位置、存放的文件夹名等 6、标记...

奥林帕斯SP800如何把照片传到电脑上
最简单的用读卡器,把内存卡插到读卡器上,就可以传照片了,或者使用数据线,也可以上传照片,机器本身内存里的照片也可以传到电脑里的

C#里面使用数据库存储图片并读取图片,图片集失真问题
string filename = Path.GetFileName(name);hpf.SaveAs(Server.MapPath("images") + "\\\\" + filename);】上传图片的代码, 要取出的时候将图片显示在image控件中,Image1.ImageUrl ="images\\\\"+ ds.Tables[0].Rows[0]["photo"].ToString();(images控件的URL)***操作要在连接了数据库的...

yy里怎样上传个人照片
首先.频道积分达到3000.积分达到了后.2.你在当前的频道里边的是频道管理员身份.3.你右点你需要放SP\/图片的子频道名字.点开后有个"频道信息"选择点开.4.点到公告.公告拦上面有各自的系统功能小图标.选择你需要的其一功能.5.将你所要放进去的SP\/图片(图片获取的是IE地址还是代码由于个人无地方研究...

YY怎么上传视频或者相册?
首先.频道积分达到3000. 2.你在当前的频道里边的是频道管理员身份.3.你右点你需要放SP的子频道名字.点开后有个"频道信息"选择点开.4.点到公告.公告拦上面有3个系统功能小图标.选择你需要的其一功能.5.将你所要放进去的SP获取SP代码.然而放到其一功能的显示框.然而选择确定.它们就会连带代码的出现...

怎么让VB.NET 上传图片到SQL 数据库只保存路径,图片保存到文件_百度知 ...
一个参考过程,你试试 这里写下一个过程为: insert into pub_infor values('1234',0x,'this is a sample') 然后读入图片: sp_textcopy @srvname = '.', @login = 'sa', @password = 'sa', @dbname = 'pubs', @tbname = 'pub_info', @colname = 'logo', @file...

苹果6spQQ空间上传照片,可是显示检测到要发送的照片不存在,已自动帮你...
可能是你内存不够或者是你清理垃圾了或者是它自动就给你删了,或者是QQ,最近就是说你保存的图片QQ都会帮你删的。

QQ空间怎样上传SP
做完上传到 www.56.com就行了,传完把视频点入视频共享象册,然后设置为首页,再不明白就去56上申请个号看看,最大可以上传200MB的视频呢希望我的回答能帮到你~呵呵 天天快乐~~ 加油哦~

ET200SP上传到电脑
1,打开博图 2,新建空白项目 3,选择在线新设备上传 4,选择PGPC 5,选择plc,上传 6,等待上传完成

NOKIA手机怎么上传图片
1、首先要在电脑端安装好PC套件,才能通过数据线或蓝牙适配器连接手机与电脑,实现资料与同步管理 2、PC的操作系统要求必须是Win2000带SP3或以上,WinXP带SP1或以上补丁的才可以安装PC套件,其他操作系统或不带SP补丁的均无法安装。到控制版面,添加或删除程序,卸载PC套件,Nokia Connectivity cable Driver ...

博白县17113218592: asp,最简单的上传图片
严盼舒萨: 1.如果服务器装了文件上传组件,可查阅一下该组件的相关属性和方法,不过现在很多服务器空间都不支持这类组件.暂不在这里讨论. 2.若服务器不支持文件上传组件,可以考虑自己写个无组件上传程序,网上有一个"化境无组件上传"比较经...

博白县17113218592: asp.net上传图片 -
严盼舒萨: .aspx<form id="form1" runat="server"> <div> <asp:FileUpload ID="f1" runat="server" /> <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> </div> </form>.aspx.cs protected void Button1_Click...

博白县17113218592: 求最简化的asp 图片上传
严盼舒萨: <html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>示例结果</title><link href="../style.css" rel="stylesheet" type="text/css"></head><body style="font-size:12px"><% Dim Upload,successful'=...

博白县17113218592: 图片上传的代码 -
严盼舒萨: <%@ language="javascript"%> <% var self = Request.serverVariables("SCRIPT_NAME"); if (Request.serverVariables("REQUEST_METHOD")=="POST") {var oo = new uploadFile();oo.path = "myFile"; //存放路径,为空表示当前...

博白县17113218592: asp无组件上传图片 -
严盼舒萨: <% strFileName = Request("file") '得到前一页提交来的文件地址值 Set objStream = Server.CreateObject("ADODB.Stream") objStream.Type = 1 ' adTypeBinary objStream.Open objStream.LoadFromFile strFileName objStream.SaveToFile Server.MapPath("abc.jpg"),2 '保存到当前ASP文件同目录下,名字为abc.jpg objStream.Close%> 够简单吧! 呵呵,不成功的话,给我留言,我帮你看看!偶也是新手,但偶用成功着呢!

博白县17113218592: 求asp无组件上传图片代码 100分悬赏 -
严盼舒萨: ASP无组件上传图片源代码 <% '上传方法,0=无组件,1=chinaaspupload dim upload_type upload_type=uploaddim uploadsuc dim Forumupload dim ranNum dim uploadfiletype dim upload,file,formName,formPath,iCount,filename,fileExt response...

博白县17113218592: 求asp上传图片到数据库的完整代码 -
严盼舒萨: 看这里,有详细答案:http://zhidao.baidu.com/question/68793867.html 调用很简单,绑定数据库后采取形如<img src="<%=img%>">的形式,<%=img%>是你数据库存储图片路径的字段 至于删除图片,要用到fso,给段基本的代码你:Set fs = ...

博白县17113218592: ASP上传图片和显示图片的代码? -
严盼舒萨: 化境无组件上传类:upload_5xsoft.inc:dim Data_5xsoftClass upload_5xsoft dim objForm,objFile,VersionPublic function Form(strFor...

博白县17113218592: asp无组件上传图片代码 -
严盼舒萨: 首先 asp3.0无组件上传时不大可能的 必须用到的组建 你使用bin格式的字段存储图像 那好多图像时不成的 会不识别 我记得是bmp的 256色的 才成 至于你下边做的只能存图片的名称 至于你存图片的你根本没写出了

博白县17113218592: ASP图片上传代码解析
严盼舒萨: 第一:可以使用responsenbsp;函数nbsp;也就是nbsp;支持上传nbsp;如果改成nbsp;nbsp;false就不行了.第二:意思》上传图片大小!第三:读取上传图片的大小第四:chrBnbsp;返回字节数的大小第五:建立驱动的nbsp;也就是占用...

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 星空见康网