推奨:ASPを取得する方法コードで最初の画像アドレスを取得する方法参照される内容は次のとおりです。「パターンをもう一度変更する」コードを検出するコード 'http://www.knowsky.com/asp.asp'leixing htmlまたはubb'nopicコードは持っていません
| 以下は引用されたコンテンツです。 example.asp <%@言語= vbscript codepage = 65001%> <! - #include file = sundyupload.asp-> <% 'この例でエンコードするドキュメントはUTF-8です。他のエンコーディングがあるシステムの場合は、エンコードを対応するエンコードに変換してください。そうしないと、フォームで取得されたデータが文字化けされる場合があります。 dim objupload、opt dim xmlpath dim fileformname、objfile、counter opt = request.querystring(opt) OPT =アップロードの場合 xmlpath = server.mappath(request.querystring(xmlpath)) '仮想パスを実際のパスに変換します objupload = new sundyupload 'アップロードオブジェクトを作成します objupload.uploadinit xmlpath、utf-8 カウンター= 1 Response.write(normal form:&objupload.form(normalform)&<br> <br>) 'フォームデータを取得します objupload.objfileの各fileformnameについて objfile = objupload.objfile(fileformname)を設定します filesize = objfile.filesize strtemp = objfile.filepath Response.write strtemp filename = mid(strtemp、instrev(strtemp、 /)1) filesize> 0の場合 Response.write(ファイルサイズ:&filesize&<br>) Response.write(ファイル名:&objfile.filepath&<br>) 'Response.Write(ファイルの説明:&objupload.form(filedesc&counter)&<br> <br>) objfile.saveas server.mappath(。)& / upload /&&filename Response.Write AT:&server.mappath(。)& / upload /&&<br> <br> ifを終了します カウンター=カウンター1 次 ifを終了します 「進行状況バーデータファイル(XMLファイル)をアップロードするための仮想パスを指定します 「複数の人が同時にアップロードし、異なる進捗データが必要になる可能性があるため、ランダムであることをお勧めします 「このパスは、提出中にアップロードコンポーネントに渡す必要があります。アップロードプロセス中に進行状況データを変更する 'クライアントはJavaScriptを使用してこのXMLファイルを読み取り、進捗状況を表示します xmlpath = upload/&&.xml %> <html> <head> <メタhttp-equiv = content-type content = text/html; charset = utf-8 /> <Title> Sundyアップロードプログレスバーの例</title> <スクリプト言語= javascript> 関数chkfrm(){ var objfrm = document.frmupload; if(objfrm.file1.value == && objfrm.file2.value ==){ アラート(ファイルを選択してください); objfrm.file1.focus(); falseを返します。 } objfrm.action = example.asp?opt = upload&xmlpath = <%= xmlpath%>; StartProgress( '<%= xmlpath%>'); //進行状況バーを開始します trueを返します。 } </script> </head> <body> <form name = frmupload method = post action = example.asp enctype = multipart/form-data onsubmit = return chkfrm()> 通常のフォーム:<br> <入力タイプ=テキストname = normalform size = 40> <br> <br> ファイル1:<br> <入力型=ファイルname = file1 size = 40> </br> <入力タイプ=テキスト名= filedesc1 size = 30> <br> <br> ファイル2:<br> <入力型=ファイルname = file2 size = 40> </br> <入力タイプ=テキスト名= filedesc2 size = 30> <br> ファイル3:<br> <入力型=ファイルname = file3 size = 40> </br> ファイル4:<br> <入力型=ファイルname = file4 size = 40> </br> ファイル5:<br> <入力型=ファイルname = file5サイズ= 40> </br> <入力タイプ=送信name = btnsubmit value = submit/> </form> </body> </html> sundyupload.asp <メタhttp-equiv = content-type content = text/html; charset = utf-8 /> <% dimdyupload_sourcedata クラスsundyupload Dim objform、objfile、バージョン、objprogress dim xmlpath、charsetencoding パブリック関数フォーム(strform) strform = lcase(strform) objform.exists(strform)ではない場合 form = それ以外 form = objform(strform) ifを終了します エンド関数 パブリックファイル(strfile) strfile = lcase(strfile) objfile.exists(strfile)ではない場合 file = new fileInfoを設定します それ以外 ファイルを設定= objfile(strfile) ifを終了します エンド関数 public sub uploadinit(progressXmlpath、charset) Dim RequestData、SSTART、CRLF、SINFO、IINFOSTART、IINFOEND、TSTREAM、ISTART、THEFILE dim ifilesize、sfilepath、sfiletype、sformvalue、sfilename dim ifindstart、ifindend dimiformstart、iformend、sformname バージョン=アップロード幅の進行状況バーバージョン1.0 objform = server.createobject(scripting.dictionary)を設定します objfile = server.createobject(scripting.dictionary)を設定します request.totalbytes <1の場合、subを終了します tstream = server.createobject(adodb.stream)を設定します Sundyupload_sourcedata = server.createobject(adodb.stream)を設定します sundyupload_sourcedata.type = 1 sundyupload_sourcedata.mode = 3 sundyupload_sourcedata.open 薄暗い合計バイト DimChunkReadSize Dim Datapart、分割 Dim ObjProgress totalbytes = request.totalbytesの合計サイズ ChunkReadSize = 64 * 1024 'ブロックサイズ64K bytesRead = 0 xmlpath = progressxmlpath charSetencoding = charset charsetencoding = thenの場合 charsetencoding = utf-8 ifを終了します objprogress = new Progressを設定します objprogress.progressinit(xmlpath) objprogress.updateprogress totalbytes、0 'ループチャンク読み取り bytesRead <totalBytesを実行します 'ブロックされた読み物 Partize = ChunkReadSize BytesRead> TotalBytesを分割する場合、分割= TotalBytes -BytesRead datapart = request.binaryread(partize) bytesRead = bytesReadは分割されます sundyupload_sourcedata.write datapart objprogress.updateprogress totalbytes、bytesRead ループ 'sundyupload_sourcedata.write request.binaryread(request.totalbytes) sundyupload_sourcedata.position = 0 requestData = sundyupload_sourcedata.read Iformstart = 1 iformend = lenb(requestdata) crlf = chrb(13)&chrb(10) sstart = midb(requestdata、1、instrb(iformstart、requestdata、crlf)-1) istart = lenb(sstart) iformstart = iformstart iStart 1 while(iformstart 10)<iformend iinfoend = instrb(iformstart、requestdata、crlf&crlf)3 tstream.type = 1 tstream.mode = 3 tstream.open sundyupload_sourcedata.position = iformstart sundyupload_sourcedata.copyto tstream、iinfoend-wiformstart tstream.position = 0 tstream.type = 2 tstream.charset = charSetencoding sinfo = tstream.readText tstream.close 'フォームプロジェクト名を取得します iformstart = instrb(iinfoend、requestdata、sstart) ifindstart = strunt(22、sinfo、name =、1)6 ifindend = strunt(ifindstart、sinfo ,, 1) sformname = lcase(mid(sinfo、ifindstart、ifindend-ifindstart))) 'ファイルの場合 If strust(45、sinfo、filename =、1)> 0 file = new fileInfoを設定します 'ファイル名を取得します ifindstart = strunt(ifindend、sinfo、filename =、1)10 ifindend = strunt(ifindstart、sinfo ,, 1) sfileName = Mid(sinfo、ifindstart、ifindend-ifindstart) thefile.filename = getFileName(sfileName) thefile.filepath = getFilepath(sfileName) 'ファイルタイプを取得します ifindstart = strunt(ifindend、sinfo、content-type:、1)14 ifindend = strums(ifindstart、sinfo、vbcr) thefile.filetype = mid(sinfo、ifindstart、ifindend-ifindstart) thefile.filestart = iinfoend thefile.filesize = iformstart -iinfoend -3 thefile.formname = sformname objfile.exists(sformname)ではない場合 objfile.add sformname、thefile ifを終了します それ以外 'それがフォームプロジェクトの場合 tstream.type = 1 tstream.mode = 3 tstream.open sundyupload_sourcedata.position = iinfoend sundyupload_sourcedata.copyto tstream、iformstart-iinfoend-3 tstream.position = 0 tstream.type = 2 tstream.charset = charSetencoding SFORMVALUE = TSTREAM.READTEXT tstream.close objform.exists(sformname)の場合 objform(sformname)= objform(sformname)&、&sformvalue それ以外 objform.add sformname、sformvalue ifを終了します ifを終了します iformstart = iformstart iStart 1 ウェンド requestData = tstream = Nothingを設定します End Sub private sub class_initialize End Sub プライベートSub Class_terminate request.totalbytes> 0の場合 objform.removeall objfile.removeall objform = Nothingを設定します objfile = Nothingを設定します sundyupload_sourcedata.close Sundyupload_sourcedata =何も設定しません ifを終了します objprogress =何も設定しません objfso = server.createobject(scripting.filesystemobject)を設定します objfso.fileexists(xmlpath)の場合 objfso.deletefile(xmlpath) ifを終了します objfso =何も設定しません End Sub プライベート機能getFilepath(FullPath) FullPathの場合は<>次に getFilepath = left(fullpath、instrrev(fullpath、)) それ以外 getFilepath = ifを終了します エンド関数 プライベート機能getFileName(FullPath) FullPathの場合は<>次に getFileName = Mid(FullPath、Instrrev(FullPath、 /)1) それ以外 getFileName = ifを終了します エンド関数 エンドクラス クラスfileInfo dim formname、filename、filepath、filesize、filetype、filestart private sub class_initialize filename = filepath = filesize = 0 filestart = 0 formName = filetype = End Sub パブリック関数Saveas(FullPath) DIM DR、エラーチャール、i saveas = true 'Response.Write FullPath&................. <br> 'filename = ss.txt trim(fullpath)=またはfilestart = 0またはfilename =またはright(fullpath、1)=/ then exit function 'Response.Write 2 ............ <br> dr = createObject(adodb.stream)を設定します Dr.Mode = 3 Dr.Type = 1 オペン博士 sundyupload_sourcedata.position = filestart sundyupload_sourcedata.copyto dr、filesize Dr.Savetofile FullPath、2 Dr.Close dr =何も設定しません saveas = false エンド関数 エンドクラス クラスの進捗 dim objdom、xmlpath 薄暗い開始時刻 private sub class_initialize End Sub Public Sub ProgressInit(xmlpathtmp) Dim Objroot、Objchild Dim objpi xmlpath = xmlpathtmp objdom = server.createobject(microsoft.xmldom)を設定します objroot = objdom.createelement(進行状況)を設定します objdom.appendChild objroot objchild = objdom.createelement(合計バイト)を設定します objchild.text = 0 objroot.appendchild objchild objchild = objdom.createelement(uploadbytes)を設定します objchild.text = 0 objroot.appendchild objchild objchild = objdom.createelement(uploadpercent)を設定します objchild.text = 0% objroot.appendchild objchild objchild = objdom.createelement(uploadspeed)を設定します objchild.text = 0 objroot.appendchild objchild objchild = objdom.createelement(合計時間)を設定します objchild.text = 00:00:00 objroot.appendchild objchild objchild = objdom.createelement(leftime)を設定します objchild.text = 00:00:00 objroot.appendchild objchild objpi = objdom.createprocessinginstruction(xml、version = '1.0' encoding = 'utf-8')をセット objdom.insertbefore objpi、objdom.childnodes(0) objdom.save xmlpath objpi =何も設定しません objchild = Nothingを設定します objroot =何も設定しません objdom =何も設定しません End Sub サブアップデートプログレス(Tbytes、rbytes) 薄暗いetime、現在の時間、速度、合計時間、残り時間、パーセント rbytes = 0の場合 starttime =タイマー objdom = server.createobject(microsoft.xmldom)を設定します objdom.load(xmlpath) objdom.selectsinglenode(// totalbytes).text = tbytes objdom.save(xmlpath) それ以外 速度= 0.0001 現在のタイム=タイマー etime = currenttime -starttime etime> 0の場合、速度= rbytes / etime TotalTime = TBYTES/SPEED leftime =(tbytes -rbytes) /速度 パーセント=ラウンド(rbytes *100 / tbytes) 'objdom.selectsinglenode(// uploadbytes).text = rbytes 'objdom.selectsinglenode(// uploadspeed).text = speed 'objdom.selectsinglenode(// totaltime).text = totaltime 'objdom.selectsinglenode(// leftime).text = leftime objdom.selectsinglenode(// uploadbytes).text = formatfilesize(rbytes)&/&formatfilesize(tbytes) objdom.selectsinglenode(// uploadpercent).text =パーセント objdom.selectsinglenode(// uploadspeed).text = formatfilesize(speed)&/sec objdom.selectsinglenode(// totaltime).text = sectotime(totaltime) objdom.selectsinglenode(// leftime).text = sectotime(leftime) objdom.save(xmlpath) ifを終了します End Sub プライベート機能セクション(SEC) DIM H:H = 0 DIM M:M = 0 dim s:s = 0 h = round(sec/3600) m = round((sec mod 3600) / 60) s = round(sec mod 60) Len(H)= 1の場合、H = 0&h LEN(M)= 1の場合、M = 0&M len(s)= 1の場合、s = 0&s sectotime =(h&:&m&:&s) エンド関数 プライベート機能formatfilesize(fsize) Dim Radio、K、M、G、Unittmp k = 1024 M = 1024*1024 G = 1024*1024*1024 ラジオ= 1 修正(fsize / g)> 0.0の場合 unittmp = gb ラジオ= g elseif fix(fsize / m)> 0次に UNITTMP = MB ラジオ= m elseif fix(fsize /k)> 0次に unittmp = kb ラジオ= k それ以外 unittmp = b ラジオ= 1 ifを終了します Radio = 1の場合 formatfilesize = fsize&&nbsp; &unittmp それ以外 formatfilesize = formatnumber(fsize/radio、3)&unittmp ifを終了します エンド関数 プライベートSub Class_terminate objdom =何も設定しません End Sub エンドクラス 'http://www.cuoxin.com/ %> <スクリプト言語= javascript> //進行状況バーを開始します 関数startProgress(xmlpath){ displayProgress(); setProgressDivpos(); setimeout(displayprogressbar( 'xmlpath')、500); } 関数displayProgressbar(xmlpath){ var xmldoc = new ActiveXObject(msxml2.domdocument.3.0); xmldoc.async = false; xmldoc.load(xmlpath); if(xmldoc.parseerror.errorcode!= 0){ var error = xmldoc.parseerror; アラート(error.reason) setimeout(displayprogressbar( 'xmlpath')、1000); 戻る; } var root = xmldoc.documentelement; //ルートノード var totalbytes = root.childnodes(0).text; var uploadbytes = root.childnodes(1).text; varパーセント= root.childnodes(2).text; Progresspercent.innerhtml =パーセント。 Progressbar.style.width =パーセント。 uploadsize.innerhtml = uploadbytes; uploadspeed.innerhtml = root.childnodes(3).text; totaltime.innerhtml = root.childnodes(4).text; leftime.innerhtml = root.childnodes(5).text; if(パーセント<100){ setimeout(displayprogressbar( 'xmlpath')、1000); } } 関数displayProgress(){ var objprogress = document.getElementById(Progress); objprogress.style.display =; } 関数closeprogress(){ var objprogress = document.getElementById(Progress); objprogress.style.display = none; } 関数setProgressDivpos(){ var objprogress = document.getElementById(Progress); objprogress.style.top = document.body.scrolltop(document.body.clientheight-document.getElementbyid(progress).offseTheight)/2 objprogress.style.left = document.body.scrollleft(document.body.clientwidth-document.getElementbyId(reswork).offsetwidth)/2; } </script> <style type = text/css> 。進捗 { 位置:絶対; パディング:4px; トップ:50; 左:400; フォントファミリー:Verdana、Helvetica、Arial、Sans-Serif; フォントサイズ:12px; 幅:250px; 高さ:100px; 背景:#fffbd1; 色:#3D2C05; 国境:1pxソリッド#715208; / * Mozilla Proprietary */ -moz-border-radius:5px; /*-Moz-opacity:0.95; */ } .progressテーブル、.progress td { フォントサイズ:9pt; } 。バー{ 幅:100%; 高さ:15px; バックグラウンドカラー:#cccccc; 境界線:1pxインセット#666666; マージンボトム:4px; } .progresspercent { フォントサイズ:9pt; 色:#000000; 高さ:15px; 位置:絶対; Z-Index:20; 幅:100%; テキストアライグ:センター; } .progressbar { バックグラウンドカラー:#91D65C; 幅:1px; 高さ:15px; } </style> <div id = progress style = display:none; class = progress> <div class = bar> <div id = progresspercent class = progresspercent> 0%</div> <div id = progressbar class = progressbar> </div> </div> <テーブルボーダー= 0セルペーシング= 0セルパディング= 2> <tr> <td> </td> <td>:</td> <td id = uploadsize> </td> </tr> <tr> <td>速度をアップロード</td> <td>:</td> <td id = uploadspeed>&nbsp; </td> </tr> <tr> <td>合計時間</td> <td>:</td> <td id = totaltime>&nbsp; </td> </tr> <tr> <td>残り時間</td> <td>:</td> <td id = lefttime>&nbsp; </td> </tr> </table> </div> |
共有:asp-server.urlencode逆関数の簡単な分析:urldecodeスペースがある場合は、代わりに使用してください。他の文字がある場合は、代わりに%ASCIIを使用してください。漢字などの4つのバイト文字がある場合は、代わりに2%ASCIIを使用してください。ただし、エンコードされた文字列をデコードする必要がある場合もありますが、ASPは関連性を提供しません