Hi Utsavi,
See if this can help you something:
Class VICS.FileUpload Extends %
ZEN.Component.page
{
/// Class name of application this page belongs to.
Parameter APPLICATION;
/// Displayed name of this page.
Parameter PAGENAME = "FileUpload";
/// Domain used for localization.
Parameter DOMAIN;
/// This XML block defines the contents of this page.
XData Contents [ XMLNamespace = "
http://www.intersystems.com/zen" ]
{
<page xmlns="
http://www.intersystems.com/zen" title="">
<form id="frmUpload" enctype="multipart/form-data">
<fileUpload id="fileUpload" name="fileUpload" label="File to upload:
"/>
<submit caption="Upload" action="save" id="Submit"/>
</form>
</page>
}
/// This callback is called when a form on this page is submitted.
/// <var>pSubmit</var> is a <class>%ZEN.Submit</class> object
/// containing details of the form submit.<br>
/// Subclasses override this method.
ClassMethod %OnSubmit(pSubmit As %ZEN.Submit) As %Status
{
kill ^TestLog
set tSC=$$$OK
if (pSubmit.%Action = "save")
{
if (%request.IsDefinedMimeData("$V_fileUpload"))
{
set mimeData = %request.GetMimeData
("$V_fileUpload")
Set file=##class(%File).%New("C:\temp\test")
Do file.Open("WSN")
do file.CopyFrom(mimeData)
set tSC = file.%Save()
}
}
Quit tSC
}
/// This callback is called at the end of the HTML HEAD section of the
page.<br>
/// (default implementation is a simple expression).
Method %OnDrawHTMLHead() As %Status
{
w "<meta http-equiv=""Content-Type"" content=""text/html;
charset=GB18030"">"
Q $$$OK
}
}
Actually it copies 1 file from 1 directory to another directory
(outside of Cache).
And probably will copy from client to server and conversely.
You should change the path where the file will be copied here:
Set file=##class(%File).%New("C:\temp\test")