| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1065 人关注过本帖
标题:自己制作的网站上传图片出现无法显示 急求解决办法!
取消只看楼主 加入收藏
我的确是菜鸟
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2008-10-25
收藏
 问题点数:0 回复次数:1 
自己制作的网站上传图片出现无法显示 急求解决办法!
Upload_Photo.asp
---------------------------------------------------------------------------------------------------<%@language=vbscript codepage=936 %>
<!--#include file="conn.asp"-->
<%
AdminName=replace(session("AdminName"),"'","")
if AdminName="" then
    call CloseConn()
    response.redirect "admin/login.asp"
    response.End()
end if

Password=replace(session("AdminPassword"),"'","")
if Password="" then
    call CloseConn()
    response.redirect "admin/login.asp"
    response.End()
end if

sql="select UserName from Admin where UserName='" & AdminName & "' and Password='" & Password & "'"
set rs=conn.execute(sql)
if rs.eof and rs.bof then
  rs.close
  response.Redirect("admin/login.asp")
  response.End()
end if
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
BODY{
BACKGROUND-COLOR: #E1F4EE;
font-size:9pt
}
.tx1 { height: 20px;font-size: 9pt; border: 1px solid; border-color: #000000; color: #0000FF}
-->
</style>

<SCRIPT language=javascript>
function check()
{
    var strFileName=document.form1.FileName.value;
    if (strFileName=="")
    {
        alert("请选择要上传的文件");
        document.form1.FileName.focus();
        return false;
      }
}
</SCRIPT>
</head>
<body leftmargin="0" topmargin="0">
<%
EditName=request("EditName")
ImageName=request("ImageName")
%>
<form action="Upfile_Photo.asp" method="post" name="form1" onSubmit="return check()" enctype="multipart/form-data">
  <input name="FileName" type="FILE" class="tx1" size="30">
  <input type="submit" name="Submit" value="上传" style="border:1px double rgb(88,88,88);font:9pt">
  <input type="hidden" name="EditName" value="<%=EditName%>">
  <input type="hidden" name="ImageName" value="<%=ImageName%>">
</form>
</body>
</html>
---------------------------------------------------------------------------------------------------
Upfile_Photo.asp
---------------------------------------------------------------------------------------------------
<%@language=vbscript codepage=936 %>
<!--#include file="Inc/config.asp"-->
<!--#include file="Inc/upfile_class.asp"-->
<%@language=vbscript codepage=936 %>
<!--#include file="conn.asp"-->
<%
AdminName=replace(session("AdminName"),"'","")
if AdminName="" then
    call CloseConn()
    response.redirect "admin/login.asp"
    response.End()
end if

Password=replace(session("AdminPassword"),"'","")
if Password="" then
    call CloseConn()
    response.redirect "admin/login.asp"
    response.End()
end if

sql="select UserName from Admin where UserName='" & AdminName & "' and Password='" & Password & "'"
set rs=conn.execute(sql)
if rs.eof and rs.bof then
  rs.close
  response.Redirect("admin/login.asp")
  response.End()
end if
%>
<%
dim upload,oFile,formName,SavePath,filename,fileExt,oFileSize
dim EnableUpload
dim arrUpFileType
dim ranNum
dim msg,FoundErr
msg=""
FoundErr=false
EnableUpload=false

%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
BODY{
BACKGROUND-COLOR: #E1F4EE;
font-size:9pt
}
.tx1 { height: 20px;font-size: 9pt; border: 1px solid; border-color: #000000; color: #0000FF}
-->
</style>
</head>
<body leftmargin="2" topmargin="5" marginwidth="0" marginheight="0" >
<%
call upload_0()  '使用化境无组件上传类
%>
</body>
</html>
<%
sub upload_0()    '使用化境无组件上传类
    set upload=new upfile_class ''建立上传对象
    upload.GetData(104857600)   '取得上传数据,限制最大上传100M
    if upload.err > 0 then  '如果出错
        select case upload.err
            case 1
                response.write "请先选择你要上传的文件!"
            case 2
                response.write "你上传的文件总大小超出了最大限制(100M)"
        end select
        response.end
    end if
    SavePath = SaveUpFilesPath   '存放上传文件的目录
    if right(SavePath,1)<>"/" then SavePath=SavePath&"/" '在目录后加(/)
        
    for each formName in upload.file '列出所有上传了的文件
        set ofile=upload.file(formName)  '生成一个文件对象
        oFileSize=ofile.filesize
        if oFileSize<100 then
            msg="请先选择你要上传的文件!"
            FoundErr=True
        else
         select case PhotoUrlID
           case 0        
            if oFileSize>(MaxFileSize*1024) then
              msg="文件大小超过了限制,最大只能上传" & CStr(MaxFileSize) & "K的文件!"
             FoundErr=true
            end if
           case 1
            if oFileSize>(10000*1024) then
              msg="文件大小超过了限制,最大只能上传10M的文件!"
             FoundErr=true
            end if
         end select        
        end if

        fileExt=lcase(ofile.FileExt)
        arrUpFileType=split(UpFileType,"|")
        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" then
            EnableUpload=false
        end if
        if EnableUpload=false then
            msg="这种文件类型不允许上传!\n\n只允许上传这几种文件类型:" & UpFileType
            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
            ofile.SaveToFile Server.mappath(FileName)   '保存文件
            response.write "文件上传成功!文件大小为:" & cstr(round(oFileSize/1024)) & "K"
            strJS=strJS & "parent.document.myform."&trim(upload.form("EditName"))&".value='" & fileName & "';" & vbcrlf
            strJS=strJS & "parent.document.myform."&trim(upload.form("ImageName"))&".src='../" &fileName& "';" & vbcrlf
        else
            strJS=strJS & "alert('" & msg & "');" & vbcrlf
              strJS=strJS & "history.go(-1);" & vbcrlf
        end if
        strJS=strJS & "</script>" & vbcrlf
        response.write strJS
        
        set file=nothing
    next
    set upload=nothing
end sub
%>
-------------------------------------------------------------------------------------------------------------------------------------------------------------
以上是那两个文件  每次上传的时候点击“上传”都是显示:

 无法显示网页
您要访问的网页有问题,无法显示。

-------------------------------------------------------

请尝试以下操作:

打开 127.0.0.1  主页,然后查找指向您感兴趣信息的链接。
单击刷新按钮,或以后再试。

单击搜索,寻找 Internet 上的信息。
也可查看相关站点列表。




HTTP 500 - 内部服务器错误
Internet Explorer
搜索更多相关主题的帖子: 办法 制作 
2008-10-25 13:38
我的确是菜鸟
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2008-10-25
收藏
得分:0 
上传按钮:<td width="50%" bgcolor="#E9F1FE"><iframe frameborder="0" width="100%" height="30px" src="../Upload_Photo.asp?EditName=Photo&ImageName=ImgPhoto"></iframe></td>
2008-10-25 13:40
快速回复:自己制作的网站上传图片出现无法显示 急求解决办法!
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.050953 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved