ASP  조경민
오후 3:54 2000-05-15
=============================================

다음은 업로드를 위한 코드이다.

<html>
<head>
<title></title>
</head>
<body>

<form action = "upload.asp" enctype="multipart/form-data" method="post">

<input type="text" name="Content">
<br>
<input type="text" name="Bro">
<br>
<input type="file" name="File1">
<input type="submit">

</form>

</body>
</html>

다음은 upload.asp 코드이다.

<%
   Dim obj

   ' NST Upload 컴포넌트를 생성.  
   set obj = Server.CreateObject("NSTUpload.Upload")
   obj.fnSaveAll "asdf"
  
  ' 업로드를 pure asp로 하려는 경우 아래의 asp 코드가 된다.  
  'Dim vntPostedData, lngCount
  'lngCount = Request.TotalBytes
  'vntPostedData = Request.BinaryRead(lngCount)
  'Response.Write Request.Form("Bro")
  '  Response.Write Request.Form("Content")
  'Dim vtPostData, lngCount
  'lngCount = Request.TotalBytes
  'vtPostData = Request.BinaryRead(lngCount)
  'Response.Write vtPostData
  
  set obj = Nothing
%>


ASP 서포팅된 Upload 컴포넌트는

STDMETHODIMP CUpload::fnSaveAll(VARIANT vsSavePath)
{
        // TODO: Add your implementation code here
                
        long nTotalBytes;
        m_piRequest->get_TotalBytes(&nTotalBytes);
        VARIANT varTotalBypes;
        varTotalBypes.vt = VT_INT;
        varTotalBypes.intVal = nTotalBytes;
        
        VARIANT        varData;
        m_piRequest->BinaryRead( &varTotalBypes, &varData );

        CSafeArray<char> arrData(varData);
        
        BROTRACE("%s", &arrData[0] );
        TestParsing( &arrData[0] );
        
        return S_OK;
}

위와 같은 코딩으로 실제 Raw 데이터를 얻을 수 있다.

-----------------------------7d02072310025a
Content-Disposition: form-data; name="Content"

aaa
-----------------------------7d02072310025a
Content-Disposition: form-data; name="Bro"

bbb
-----------------------------7d02072310025a
Content-Disposition: form-data; name="File1"; filename="C:\bro\aaa.xml"
Content-Type: text/xml

<?xml?>
....
-----------------------------7d02072310025a

'KB > MFC/Win32' 카테고리의 다른 글

다국어 지원 하기 Resource DLL  (0) 2004.03.19
MemoryDC 만들기  (0) 2004.03.19
파레트 in MemoryDC 비트맵  (0) 2004.03.19
트리 에디트 가능하게 하기  (0) 2004.03.19
툴바 리바 색깔 바꾸기  (0) 2004.03.19

+ Recent posts