JAVA â°í
JSP ¼Ò½ºÃ¢°í
±âŸ
1 ÆäÀÌÁö
À§ÀÇ À§Ä¡¿¡ ÀÖ´Â JSP SmartUpload ÇÁ·Î±×·¥ÀÇ sample1.jsp ÇÁ·Î±×·¥À» ÀÀ¿ëÇÏ¿© Visual Basic ¿¡¼ Http¹æ½ÄÀ¸·Î
ÀÏ¹Ý Excel ÆÄÀÏÀ» Upload ÇÏ·Á°í ÇÕ´Ï´Ù. ¾Æ·¡ ÇÁ·Î±×·¥Àº VB ÇÁ·Î±×·¥ ÀÔ´Ï´Ù. ¹¹°¡ À߸ø됬´ÂÁö..
Ȥ½Ã ¾Æ½Ã´Â ºÐÀº ÇÑ ¼ö °¡¸£ÃÄ ÁÖ½Ã±æ ºÎŹµå¸³´Ï´Ù. Jsp ÇÁ·Î±×·¥ÀÌ ¹®Á¦ÀÎÁö.. VB ÇÁ·Î±×·¥ÀÌ ¹®Á¦ÀÎÁö..
---------------------------------- jsp ÇÁ·Î±×·¥ -------------------------------------------------
<%@ page language="java" import="com.jspsmart.upload.*"%>
<jsp:useBean id="mySmartUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />
<HTML>
<BODY BGCOLOR="white">
<H1>jspSmartUpload : Sample 1</H1>
<HR>
<%
// Variables
int count=0;
// Initialization
mySmartUpload.init(config);
mySmartUpload.service(request,response);
mySmartUpload.setTotalMaxFileSize(10000000);
// Upload
mySmartUpload.upload();
// Save the files with their original names in a virtual path of the web server
count = mySmartUpload.save("/upload");
// mySmartUpload.getFiles().getFile(0).saveAs("/test.txt");
// Display the number of files uploaded
out.println(count + " file(s) uploaded.");
%>
----------------------------- VB ÇÁ·Î±×·¥ -----------------------------------------------------------
Private Sub CmdUpLoad_Click()
Dim inetUpload As Inet
Dim FileContents() As Byte
Dim vFileName As String
Dim header, strPOST, Boundary, idboundary As String
Set inetUpload = New Inet
If inetUpload.StillExecuting = True Then
inetUpload.Cancel
End If
vFileName = "C:\CCC.xls"
header = "Content-type: multipart/form-data" & vbCrLf
strPOST = "--" & Boundary & vbCrLf & _
"Content-Disposition: form-data; name=""vFileName""" & vbCrLf & vbCrLf & _
""" & EncodeBin & """ & vbCrLf & _
"--" & Boundary & vbCrLf
With inetUpload
.Protocol = icHTTP
'.Document = "/Jupload.jsp?file=" & vFileName '<--- ½ÇÇàµÇ¾î¾ß ÇÒ JSP ÆÄÀÏ ÁöÁ¤.
.URL = "10.80.36.124/Jupload.jsp"
.AccessType = icDirect
'.RemoteHost = "10.80.36.124" ' txtServer.Text
'.RemotePort = 80
.Execute "10.10.10.10/Jupload.jsp", "POST", strPOST, header
Do While .StillExecuting
DoEvents
Loop
End With
' Dim retCancel As Boolean
' RaiseEvent UploadStarted(vFileName, retCancel)
'
' If retCancel = True Then
' CancelUpload (True)
' End If
End Sub