日期:2014-05-17  浏览次数:20952 次

如何response.Write出两个数相除的结果,并且结果取小数后两位,同时加上kb?
做个文件上传功能,在信息提交页有文件上传后的路径和文件大小两个文本框,然后用 <iframe> 的方式调用文件上传页,用的是风声无组件2.11,目前能在文件上传后自动把文件上传后的保存路径显示在信息提交页的路径文本框中,现在我想把这个文件的大小也自动显示在文件大小文本框中,目前有个问题,就是如何用response.Write出两个数相除的结果,并且结果取小数后两位,把这个值自动体现在信息提交页的文件大小文本框中?

信息提交页相关代码:
<input   name= "BigImg "   type= "text "   class= "Input "   id= "BigImg "   size= "50 "> <input   name= "Imgsize "   type= "text "   id= "Imgsize "   class= "Input ">
<a   href= "javascript:; "   onClick= "javascript:open_win( 'Img_upload.asp?UpStyle=AddImg ', 'contact ',463,380, 'no '); "> 上传图片 </a>

Img_upload.asp相关代码如下:
<table   width= "100% "     border= "0 "   cellspacing= "1 "   cellpadding= "0 "   style= "background-color:#F0F0F0; ">
<form   name= "form111 "   enctype= "multipart/form-data "   method= "post "   action= "Upload_Save.asp?UpStyle=AddProductImg ">
                        <tr>
                    <td   width= "84% "   class= "tdbg "> 大图:
                        <input   name= "strPhoto2 "   type= "file "   id= "strPhoto2 ">  
                        (不能超过1024K即1M) <br> 小图:
                        <input   name= "strPhoto1 "   type= "file "   id= "strPhoto1 "> (不能超过150K)   <input   type= "submit "   name= "Submit "   value= "上   传 "   class= "button01-out "> </td>
                </tr>
</form> </table>

upload_save.asp部分代码如下:
<%
Sub   Save_AddProductImg()
%>
<script   language= "Javascript ">
function   ShowUrl(BigUrl,SmallUrl,Imgsize)
{
window.opener.document.form1.BigImg.value=BigUrl;
window.opener.document.form1.SmallImg.value=SmallUrl;
window.opener.document.form1.Imgsize.value=Imgsize;   '这个是我自己加上的

}
</script>
<%
dim   request2  
'建立上传对象
set   request2=New   UpLoadClass
'设置为手动保存模式
request2.AutoSave=2
Request2.FileType= "gif/jpg/jpeg/bmp "

'设置服务器文件保存路径
Request2.SavePath= "../UploadFiles/ "
'打开对象
request2.open()
%>
<table   width= "100% "     border= "0 "   cellspacing= "1 "   cellpadding= "0 "   style= "background-color:#F0F0F0; ">
<tr>  
<td>
<%
'设置产品大图最大为1024K
'当然这里还可以设置不同的保存路径,限制格式
request2.MaxSize=1024000
'如果保存大图成功
if   request2.Save( "strPhoto2 ",0)   then
'显示保存位置
Dim   BigUrl
BigUrl=request2.SavePath&request2.Form( "strPhoto2 ")
response.Write( " <br> 产品大图: "&BigUrl)
If   Left(BigUrl,3)= ".