Home > Products > DEXTUploadX > Code Sample  
 
 
 
 Examples of upload (refer to sample page except for simple uploads such as POST and PUT
    upload)

    1.  Example of Simple POST uploads
    2.  Example of Simple PUT uploads
    3. Example of folder structure uploads 
    4. Introducing basic method, property, event of file upload manager
    5. Introducing basic method, property, event of file upload monitor
    6. Example of adding form item defined by user
    7. Example of uploading from Unicode and other language page (Multi-language upload)
    8. Example of user uploading optimized transmission page to the user’s website by creating the page.
    9. Example of utilizing on document transmission that requires AES encryption transmission.
    10. Example of transmission processing when there is no file to transmit or add and processing files 
          uploaded to server at will (Modifying bulletin board, etc)
    11. Example of using file added at the object of file uploading
    12. Example of uploading file through proxy server
    13. Example of uploading under SSL environment

 Examples of download (refer to sample page except for simple downloads)
    1. Example of downloading simple files 
    2. Example of continued downloading of file 
    3. Introducing basic method, property, event of file download manager
    4. Introducing basic method, property, event of file download monitor
    5. Example of user downloading optimized transmission page from the user’s website by creating the
        page.
    6. Example of utilizing on document transmission that requires AES encryption transmission.
    7. Example of using file added at the object of file downloading
    8. Example of downloading file through proxy server 
    9. Example of downloading under SSL environment
Upload
1. Simple example of POST upload
It is the simplest POST type upload, and it supports drag & drop function that you just simply can drag a file or a folder and then drop it where you want

[SimplePostUpload.htm]
<HTML>
<HEAD>

<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<TITLE>The simplest example of POST type.</TITLE>

<SCRIPT FOR="FileUploadManager" Event="OnError(nCode, sMsg, sDetailMsg)" LANGUAGE="javascript">
OnFileManagerError(nCode, sMsg, sDetailMsg);
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
// sMsg is a summarized error message.
// sDetailMsg is an error message with more details.
// sDetailMsg can be empty per type of error message.
// You have to make the declaration as shown above.
// This type of error handling has all the same controls as DEXTUploadX.
function OnFileManagerError(nCode, sMsg, sDetailMsg)
{
alert(nCode);
alert(sMsg);
alert(sDetailMsg);
}
</SCRIPT>

<SCRIPT LANGUAGE="VBS" for="FileUploadManager" event="OnTransfer_Click()">
'If you click on the transfer button of file upload manager, 'OnTransfer_Click' event occurs as shown above.
' From here, open file uploadmonitorscreenasshownbelow.
winstyle="height=355,width=445,status=no,toolbar=no,menubar=no,location=no"
window.open "./FileUploadMonitor.htm",null,winstyle
</SCRIPT>
</HEAD>

<BODY>
<OBJECT id="FileUploadManager"
codeBase="http://Localhost/DEXTUploadX/DEXTUploadX.cab#version=2,0,2,0"
height="200" width="450" classid="CLSID:DF75BAFF-7DD5-4B83-AF5E-692067C90316" VIEWASTEXT>
</OBJECT>
</BODY>
</HTML>

[FileUploadMonitor.htm]

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<TITLE>DEXTUploadX upload</TITLE>

<SCRIPT FOR="FileUploadMonitor" Event="OnError(nCode, sMsg, sDetailMsg)" LANGUAGE="javascript">
OnFileMonitorError(nCode, sMsg, sDetailMsg);
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
function OnFileMonitorError(nCode, sMsg, sDetailMsg)
{
alert(nCode);
alert(sMsg);
alert(sDetailMsg);
}
</SCRIPT>

<SCRIPT LANGUAGE="VBS">
sub OnLoading()
' In case of Post method, Post Script file should be indicated in the property of UploadURL.
' To use a port besides standard port,
' use the same method as standard method of address assignment as follows.
' http://Localhost:8080/DEXTUploadX/Upload/PostScript.asp
document.all("FileUploadMonitor").UploadURL = "http://Localhost/DEXTUploadXSamples/Upload/PostScript.asp"
' Copy all the files and form items in file manager control of the parent page of the current page to the file monitor control.
document.all("FileUploadMonitor").Items = opener.document.all("FileUploadManager").Items
' Copy values of properties of file manager such as DefaultPath, Filter, and etc. to the file monitor.
document.all("FileUploadMonitor").Properties = opener.document.all("FileUploadManager").Properties
end sub
</SCRIPT>
</HEAD>

<BODY onload="OnLoading()" bottomMargin=0 leftMargin=0 topMargin=0 rightMargin=0>
<OBJECT id=FileUploadMonitor height=355 width=445
classid=CLSID:96A93E40-E5F8-497A-B029-8D8156DE09C5
CodeBase="http://Localhost/DEXTUploadX/DEXTUploadX.cab#version=2,0,2,0" VIEWASTEXT>
</OBJECT>
</BODY>
</HTML>
 
2. Simple example of PUT upload
For PUT upload, just change 2 things from Post upload code.
document.all("FileUploadMonitor").EnablePutMode
document.all("FileUploadMonitor").UploadURL

Refer to the source of file upload monitor for details.

Please refer to manual for configuration of server for PUT upload.
(The authority configuration of virtual path that file will be uploaded through should be set.)

[SimplePutUpload.htm]

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<TITLE>The simplest example of PUT upload</TITLE>

<SCRIPT FOR="FileUploadManager" Event="OnError(nCode, sMsg, sDetailMsg)" LANGUAGE="javascript">
OnFileManagerError(nCode, sMsg, sDetailMsg);
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
function OnFileManagerError(nCode, sMsg, sDetailMsg)
{
alert(nCode);
alert(sMsg);
alert(sDetailMsg);
}
</SCRIPT>

<SCRIPT LANGUAGE="VBS" for="FileUploadManager" event="OnTransfer_Click()">
winstyle="height=355,width=445,status=no,toolbar=no,menubar=no,location=no"
window.open "FileUploadMonitor.htm",null,winstyle
</SCRIPT>
</HEAD>
<BODY>
<P><OBJECT id="FileUploadManager"
codeBase="http://Localhost/DEXTUploadX/DEXTUploadX.cab#version=2,0,2,0"
height="200" width="450" classid="CLSID:DF75BAFF-7DD5-4B83-AF5E-692067C90316" VIEWASTEXT>
</OBJECT></P>
</BODY>
</HTML>

[FileUploadMonitor.htm]

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<TITLE>DEXTUploadX upload</TITLE>

<SCRIPT FOR="FileUploadMonitor" Event="OnError(nCode, sMsg, sDetailMsg)" LANGUAGE="javascript">
OnFileMonitorError(nCode, sMsg, sDetailMsg);
</SCRIPT>

<SCRIPT LANGUAGE="JavaScript">
function OnFileMonitorError(nCode, sMsg, sDetailMsg)
{
alert(nCode);
alert(sMsg);
alert(sDetailMsg);
}
</SCRIPT>

<SCRIPT LANGUAGE="VBS">
sub OnLoading()
' To use Put upload, the property of EnablePutMode has to be TRUE as follows.
document.all("FileUploadMonitor").EnablePutMode = TRUE
' For the property of UploadURL, input the location of virtual path of uploaded server.
document.all("FileUploadMonitor").UploadURL = "http://Localhost/DEXTUploadXSamplesData"

document.all("FileUploadMonitor").Items = opener.document.all("FileUploadManager").Items
document.all("FileUploadMonitor").Properties = opener.document.all("FileUploadManager").Properties
end sub
</SCRIPT>
</HEAD>
<BODY onload="OnLoading()" bottomMargin=0 leftMargin=0 topMargin=0 rightMargin=0>
<OBJECT id=FileUploadMonitor height=355 width=445
classid=CLSID:96A93E40-E5F8-497A-B029-8D8156DE09C5
CodeBase="http://Localhost/DEXTUploadX/DEXTUploadX.cab#version=2,0,2,0" VIEWASTEXT>
</OBJECT>
</BODY>

</HTML>
Download
1. Simple example of file download
[SimpleDownload.htm]

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<TITLE>Simple example of file download.</TITLE>

<SCRIPT FOR="FileDownloadManager" Event="OnError(nCode, sMsg, sMsgDetail)" language="javascript">
OnErrorDownloadManager(nCode, sMsg, sMsgDetail);
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
function OnErrorDownloadManager(nCode, sMsg, sMsgDetail)
{
alert(nCode);
alert(sMsg);
alert(sDetailMsg);
}
</SCRIPT>

<SCRIPT LANGUAGE="VBS" for="FileDownloadManager" event= "OnDownload_Click()">
Msgbox"OnDownload_Clickoccurrenceofevent"<br>winstyle="height=445,width=445,status=no,toolbar=no,menubar=no,location=no"
window.open "FileDownloadMonitor.htm",null,winstyle
</SCRIPT>

<script language="vbs">
Sub OnLoading()
// URL of file, file size, file name(file name can be omitted)
document.all("FileDownloadManager").AddFile "http://Localhost/DEXTUploadXSamples/Download/DEXTUploadXTestFile1.tst", 10000000
document.all("FileDownloadManager").AddFile "http://Localhost/DEXTUploadXSamples/Download/DEXTUploadXTestFile2.tst", 20000000
document.all("FileDownloadManager").AddFile "http://Localhost/DEXTUploadXSamples/Download/DEXTUploadXTestFile3.tst", 30000000, "DevpiaTest3.tst" < br> EndSub<br><br>SubOpenDownloadMonitor()<br>winstyle="height=445,width=445,status=no,toolbar=no,menubar=no,location=no"
window.open "FileDownloadMonitor.htm",null,winstyle
End Sub
</script>
</HEAD>

<BODY onload="OnLoading()">
<P><OBJECT ID="FileDownloadManager" height="200" width="450"
CodeBase = "http://Localhost/DEXTUploadX/DEXTUploadX.cab#version=2,0,2,0"
CLASSID="CLSID:535AE497-8E85-45F8-AF36-2DFCBCA8B68A"></OBJECT></P>
<P><INPUT type="button" value="open download monitor window" onclick="OpenDownloadMonitor()"></P>
</BODY>
</HTML>

[FileDownloadMonitor.htm]

<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">

<TITLE>DEXTUploadX download</TITLE>

<SCRIPT FOR="FileDownloadMonitor" Event="OnError(nCode, sMsg, sDetailMsg)" Language="javascript">
OnErrorDownloadMonitor(nCode, sMsg, sDetailMsg);
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
function OnErrorDownloadMonitor(nCode, sMsg, sDetailMsg)
{
alert(nCode);
alert(sMsg);
alert(sDetailMsg);
}
</SCRIPT>

<SCRIPT LANGUAGE="VBS">
sub OnLoading()
' save items that file download manager passes
document.all("FileDownloadMonitor").Items = opener.document.all("FileDownloadManager").Items
end sub
</SCRIPT>
</HEAD>

<BODY onload="OnLoading()" bottomMargin=0 leftMargin=0 topMargin=0 rightMargin=0>
<OBJECT ID="FileDownloadMonitor" height=445 width=445
CodeBase = "http://Localhost/DEXTUploadX/DEXTUploadX.cab#version=2,0,2,0"
CLASSID="CLSID:471678BB-F992-4BE6-9761-7767883E8619">
</OBJECT>
</BODY>
</HTML>
 
 
Move to devpia     Address: 5F, Mirae Building, 87-2, Nonhyun-dong, Gangnam-gu, Seoul, Korea Tel: +82-2-6719-6200  Business Registration Number: 220-81-90008
  Copyright ⓒ 2007 DEVPIA, Inc. All rights reserved.