Home > Products > DEXTUpload Professional > Code Sample  
 
 
 
 File Upload Default
   1. Automatic Creation of Folders 
   2. Uploading with Other Form Elements 
   3. Obtaining size of image file

 File Upload Application
   1. Uploading by using one ASP page
   2. Limiting uploadable file type
   3. Multi language supported uploading

 Upload Progress Information

 File Download 
   1. File Download
   2. Downloading database BLOB

 BLOB Manager
   Save File in the server into Database BLOB field

 Image Manager

 Cache File Manager
File Upload Default
1. Automatic Creation of Folders
In the case when AutoMakeFolder property of DEXT.FileUpload object is True, if the folder does not exist, then a new folder is created automatically. In case of uploading, it is useful when the saved folder is set to the dynamic property .

[Input form page]
<HTML>
<BODY>
<FORM NAME= "write_form" METHOD="post" ACTION="SimpleUpload_process.asp"
ENCTYPE= "multipart/form-data" ID="Form1">
<INPUT TYPE="file" NAME="file1" ID="File1">
<INPUT TYPE="submit" VALUE="upload" ID="Submit1" NAME="Submit1">
</FORM>
</BODY>
</HTML>


[Uploading process page]
<%@ LANGUAGE="VBSCRIPT"%>
<HTML>
<BODY>
<%
Set uploadform = Server.CreateObject("DEXT.FileUpload")
'In case when the property of AutoMakeFolder is set to true, the folder by DEXT.FileUpload object
dose not exist, it is created automatically.
uploadform.AutoMakeFolder = True
uploadform.DefaultPath = "C:\Temp"
uploadform.Save “C:\Temp\TestFolder”
Set uploadform = Nothing
%>
</BODY>
</HTML>
 
2. Uploading with Other Form Elements
Other elements like the file element can be referred through the property value of NAME.
In case of uploading data, if it is set as <form enctype="multipart/form-data".... ID="Form1">,
then you can not get the value by the method such as request("element_name")

[Input form page]
<HTML>
<BODY>
<FORM NAME="write_form" METHOD="post" ACTION="UploadWithElements_Process.asp"
ENCTYPE="multipart/form-data" ID="Form1">
<INPUT TYPE="text" NAME="title" ID="Text1">
<TEXTAREA NAME="content" ROWS="10" COLS="50" ID="Textarea1"></TEXTAREA>
<INPUT TYPE="file" NAME="file1" ID="File1>
<INPUT TYPE="submit" VALUE="upload" ID="Submit1" NAME="Submit1">
</FORM>
</BODY>
</HTML>
[Uploading process page]
<%@ LANGUAGE="VBSCRIPT"%>
<HTML>
<BODY>
<%
Set uploadform = Server.CreateObject("DEXT.FileUpload")
uploadform.DefaultPath = "C:\TEMP"
title = uploadform ("title")
content = uploadform ("content")
uploadform ("file1").Save
Set uploadform = Nothing
%>
<HTML>
<BODY>
<%
If uploadform("file").IsImageItem() Then
Response.Write uploadform.ImageFormat
Response.Write uploadform.ImageWidth
Response.Write uploadform.ImageHeight
End If
%>
</BODY>
</HTML>
<%
Set uploadform =nothing
%>
 
3. Obtaining size of image file

This shows the information about width and height of uploaded image file.
Supported Extensions are BMP, EMF, EXIF, GIF, Icon, JPEG, PNG, TIFF, WMF etc,..
Users can check upload file whether it is an image file or not through IsImageItem() method
in the example below.

[HOT]
In DEXTUpload Professional DEXT.ImageProc object is newly added. Using this object
can process various image file such as image water mark, creation of thumbnail image,
image format conversion.

[Input form page]
<HTML>
<BODY>
<FORM NAME="write_form" METHOD="post" ACTION="GetImageSize_Process.asp"
ENCTYPE="multipart/form-data" ID="Form1">
<INPUT TYPE="file" NAME="file1" ID="File1">
<INPUT TYPE="submit" VALUE="upload" NAME="Submit1" ID="Submit1">
</FORM>
</BODY>
</HTML>

[Uploading process page]
<%@ Language=VBScript %>
<% set uploadform=server.CreateObject("DEXT.FileUpload")
uploadform.DefaultPath="C:\TEMP"
FileName = uploadform.Save()
%>
<HTML>
<BODY>
<%>
If uploadform("file").IsImageItem() Then
Response.Write uploadform.ImageFormat
Response.Write uploadform.ImageWidth
Response.Write uploadform.ImageHeight
End If
%>
</BODY>
</HTML>
<%>
Set uploadform =nothing
%>
 
File Upload Application
1. Uploading by using one ASP page
This shows the file uploading progress in one page by using Post method.
In order to progress it in one page, if it is not the case called by
<FORM METHOD="POST"... ID="Form1">. it displays the input form, if it is the case called by
<FORM METHOD="POST" NAME="form1"> uploading is proceeded.

[Input form page]
<HTML>
<HEAD>
<%
If Request.ServerVariables("Request_Method")<>"POST" Then
%>
</HEAD>
<BODY>
<FORM NAME="write_form" METHOD="post" ACTION="OnePageUpload.asp"
ENCTYPE="multipart/form-data" ID="Form1">
<INPUT TYPE="file" NAME="file1" ID="File1">
<BR>
<INPUT TYPE="submit" VALUE="upload" NAME="Submit1" ID="Submit1">
<%
ELSE
set uploadform=server.CreateObject("DEXT.FileUpload")
uploadform.DefaultPath="C:\TEMP"
FileName=uploadform.save
%>
</FORM>
</BODY>
</HTML>
 
2. Limiting uploadable file type

If MimeType property provided by DEXTUpload Professional is used you can limit
uploadable file types. JPG GIF can be uploaded in the following example.

[Input form page]
<HTML>
<BODY>
<FORM NAME="write_form" METHOD="post" ACTION="RestrictFileType_Process.asp"
ENCTYPE="multipart/form-data" ID="Form1">
<INPUT TYPE="file" NAME="file1" ID="File1">
<INPUT TYPE="submit" VALUE="upload" NAME="Submit1" ID="Submit1">
</FORM>
</BODY>
</HTML>

[Uploading process page]
<%@ Language=VBScript %>
<%
set uploadform=server.CreateObject("DEXT.FileUpload")
uploadform.DefaultPath="C:\TEMP"
'Obtain mime_type of uploaded file.
file_MimeType=uploadform("file").MimeType
'In case when'MimeType is not image/jpeg ,image/gif upload is stopped
if file_MimeType <> "image/pjpeg" and file_MimeType <> "image/gif" then
%>
<HTML>
<BODY>
Cancel upload!!
Support files that MimeType is "image/pjpeg" or "image/gif" only.
<a href="javascript:history.go(-1)">[ back ]</a>
<%
'In casr of using 'Response.End, if there is any open item, it should be closed .
set uploadform=nothing
Response.End
else
'In case when 'MimeType is image/jpeg ,image/gif, it can be uploaded normally
FilePath = uploadform("file").Save
%>
Original Path : <%= uploadform("file").FilePath %>
Upload Path : <%= FilePath %>
File Size : <%= uploadform("file").FileLen %> bytes
MimeType : <%= uploadform("file").MimeType %>
LastSavedFileName : <%= uploadform("file").LastSavedFileName %>
LastSavedFilePath : <%= uploadform("file").LastSavedFilePath %>
<%end if%>
</BODY>
</HTML>
<%
Set uploadform =nothing
%>
 
3. Multi language supported uploading
Using CodePage property provided by DEXTUpload Professional CodePage can process
the value of form element with foreign languages and Unicode file name. In the web page
that uses foreign languages or Unicode, the value of code page corresponding to character
set used in this page should be designated as Code page value of upload component.
The default is a value of codepage set in the system. Provided that, if the value of
Session.CodePage is clearly designated in ASP code the value become the default.
In this case, the designation of CodePage property value may be omitted The following is
an example that DEXTUpload is used in the web page that Unicode character set is used.

[Input form page]
<%
'UTF-8 Codepage declaration
old_codepage = Session.CodePage
Session.CodePage = "65001"
%>
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
</HEAD>
<BODY>
<FORM NAME="write_form" METHOD="post" ACTION="GlobalEnvironment_Process.asp"
ENCTYPE="multipart/form-data" ID="Form1">
<tr>
<td width="100"><b>TextArea</b></td>
<td width="500">
<textarea name="txtvalue" rows=10 cols=50 ID="Textarea1"></textarea>
</td>
</tr>
<INPUT TYPE="file" NAME="file1" ID="File1">
<BR>
<INPUT TYPE="submit" VALUE="upload" NAME="Submit1" ID="Submit1">
</FORM>
</BODY>
</HTML>
<%
Session.CodePage = old_codepage
%>
 
Upload Progress Information
[Upload progress window for user’s definition]

Using upload process information object provided by DEXTUpload Professional can show
the file upload process graphically and monitor information that displays upload speed,
total contents size and uploaded contents size, remained time and present working process
in real time without using additional client software such as ActiveX Control or Java Applet
If you change upload process window, edit Progress.asp file. This function is performed by
Progress item, and following method and property are provided.

[Method]

- SetProgressID() : Set ID obtained by GetProgressID through this function.
- GetProgressID() : Get ID. And users can use it in the case of FileUpload and Progress

[Property]

- TotalSize : Total uploaded size
- TransferSize : Transfer data size(Byte)
- Percent : upload process percentage
- BytesPerSec : Upload speed / Byte per second
- FileName : shows uploading file name.
- Working : In case of true, upload is proceeded, in case of false, all woking process is complete.

[HOT]

Because the previous DEXTUpload created tag by dynamically moving UI of process window in
the server component, it may be considerably loaded to server. If possible, It may be better to use
the new method.

[Input form page]
<%
'The part that displays process condition of file uploading
dim ProgressID
set obj = server.CreateObject("DEXT.Progress")
'Get ID. users can use it in the case of FileUpload and Progress
ProgID = obj.GetProgressID()
set obj = nothing
%>
<HTML>
<HEAD>
<SCRIPT language="javascript">
<!--
function ShowProgress() {
strAppVersion = navigator.appVersion;
if (strAppVersion.indexOf('MSIE') != -1 && strAppVersion.substr(strAppVersion.indexOf('MSIE')+5,1) > 4)
{
winstyle = "dialogWidth=385px; dialogHeight:160px; center:yes";
window.showModelessDialog("../Progress/progress.asp?Progressid=<%=ProgID%>",null,winstyle);
}
else {
winpos = "left=" + ((window.screen.width-380)/2) + ",top="+((window.screen.height-110)/2);
winstyle="width=380,height=110,status=no,toolbar=no,menubar=no,location=no,resizable=no,
scrollbars=no,copyhistory=no," + winpos;
window.open("../Progress/progress.asp?Progressid=<%=ProgID%>",null,winstyle);
}
write_form.submit();
return true;
}
//-->
</SCRIPT>
</HEAD>
<BODY> < BR><FORM NAME= "write_form"METHOD= "post"ACTION="SimpleUpload_Process.asp?<BR>ProgressID=<%=ProgID=%>"
ENCTYPE="multipart/form-data" onsubmit="return ShowProgress()" ID="Form1">
<INPUT TYPE="file" NAME="file1" ID="File1">
<INPUT TYPE="submit" VALUE="upload" NAME="Submit1" ID="Submit1">>
</FORM>
</BODY>
</HTML>
[Uploading process page]
<%@ LANGUAGE="VBSCRIPT"%>
<HTML>
<BODY>
<%
'ID obtained by GetProgressID
ProgID = request.QueryString("ProgressID")
Set uploadform = Server.CreateObject("DEXT.FileUpload")
'Set ID obtained by 'GetProgressID through this function.
uploadform.SetProgress(ProgID)
uploadform.DefaultPath = "C:\TEMP"
uploadform ("file1").Save
Set uploadform = Nothing
%>
</BODY>
</HTML>
[Uploading progress window page]
<%@ Language=VBScript EnableSessionState="False" %>
<%Option Explicit
Dim Progress, Percent, TransferBytes, TotalBytes, BytesPer, bWorking,
strFileName
Set Progress = Server.CreateObject("DEXT.Progress")
'Designate Process situation ID delivered by GET method.
Progress.SetProgressID( Request.QueryString("ProgressID"))
'Read the value of present uploading process.
Percent = Progress.Percent
TransferBytes = Progress.TransferSize
TotalBytes = Progress.TotalSize
BytesPer = Progress.BytesPerSec
bWorking = Progress.Working
strFileName = Progress.FileName
%>
<html>
<Head>
<title></title>
<%
'In case of uploading progress, the progress situation is updated one time per 1 second.
Response.Write "<Meta HTTP-EQUIV=""Refresh"" CONTENT=1>"
%>
</head>
<body>
<%
If bWorking = true Then
'Output uploading process situation.
Response.Write "Process percentage: " & TransferBytes & "/" & TotalBytes & " (" &
Percent & "%)<br>"
Response.Write "Transfer speed: " & BytesPer & " bytes/sec<br>"
Response.Write "Transfer file: " & strFileName & <"br>"
Else
'Upload is complete.
Response.Write "complete."
End If
%>
</Table>
</Body>
</Html>

[Upload progress window for fixed type]
This is the method provided by the previous DEXTUpload version.
If possible, you’d better use user’s definition method newly supported by DEXTUpload Professional.
This function is performed by FileUploadMonitor object. The following method will be provided.
UseMonitor() : This is called by the page that writes Form. It turns on the monitoring
function of Progress Bar.
ShowMonitor() : This is called by the page(window) that shows Progress Bar.
This shows upload process situation.
[Input form page]
<%@ LANGUAGE="VBSCRIPT"%>
<%
'The part that shows process situation of file uploading
Set objMon = Server.CreateObject("DEXT.FileUploadMonitor")
objMon.UseMonitor(True)
Set objMon = Nothing
%>
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--
function ShowProgress() {
strAppVersion = navigator.appVersion;
if (document.writeform.file1.value != "") {
if (strAppVersion.indexOf('MSIE')!=-1 && strAppVersion.substr
(strAppVersion.indexOf('MSIE')+5,1) > 4) {
winstyle = "dialogWidth=385px; dialogHeight:150px; center:yes";
window.showModelessDialog("show_progress.asp?nav=ie", null, winstyle);
}
else {
winpos = "left=" +((window.screen.width-380)/2)+",top="+
((window.screen.height-110)/2);<br>winstyle="width=380,height=110,<BR>status=no,toolbar=no,menubar=no," +
"location=no,resizable=no,scrollbars=no,copyhistory=no," + winpos;
window.open("show_progress.asp",null,winstyle);
}
}
return true;
}
//-->
</SCRIPT>
</HEAD>
<BODY>
<FORM NAME="writeform" METHOD="post" ACTION="ProgressBar_Process.asp"
ENCTYPE="multipart/form-data" onSubmit="return ShowProgress();" ID="Form1">
<INPUT TYPE="file" NAME="file" ID="File1"><BR>>
<INPUT TYPE="submit" VALUE="upload" ID="Submit1" NAME="Submit1">
</FORM>
</BODY>
</HTML>
In order to use Progress Bar, like the example above, UseMonitor() method of
FileUploadMonitor object in the upper part of Form writing page should be called by setting
true as an element . If UserMonitor() method is not called or it is called by False element,
Progress bar is not operated . According to the example above, You can find that Java script
function which is called ShowProgress() before submitting Form, is called and new window(pane
or dialog box) is occurred in order to show Progress Bar graphically. At this time, The page shown
in the new window is as follows.
[Uploading progress window page(show_progress.asp)]
<%@ EnableSessionState=False%>
<%
'In case of Netscape Navigator
If Request("nav") = "ns" Then
%>
<frameset rows="80,1*" border="0" framespacing="0" frameborder="no">
<frame src="show_prog_body.asp" noresize scrolling="NO" frameborder="NO" name="sp_body">
<!-- Like Netscape Navigator, The web browser that does not support inline frame is required -->
<frame src="show_prog_bottom.asp" noresize scrolling="NO" frameborder="NO" name="sp_bottom">
<%
'in case of 'Internet Explorer
Else
%>
<HTML>
<HEAD>
<TITLE>Uploading Files...</TITLE>
<STYLE type="text/css">
td {font-size: 9pt}
</STYLE>
</HEAD>
<BODY bgcolor="#d4d0c8" leftmargin="8" topmargin="0" scroll="no">
<IFRAME src="show_prog_body.asp" title="Progress Step1" frameborder=0
marginheight=0 marginwidth=0 noresize scrolling=no width=365 height=65>
</IFRAME>
<TABLE border="0" width="365" cellpadding="2" cellspacing="0" bgcolor="#d4d0c8" ID="Table2">
<TR><TD>Click the <B>STOP</B> button on your browser to abort uploading.</TD></TR>
</TABLE>
</BODY>
</HTML>
<%
End If
%>
In order to show Progress Bar, you need not only show_progress.asp above but also the following
show_prog_body.asp and show_prog_bottom.asp.

- show_progress.asp: in order to show Progress Indicator, web page is divided into frame.
- show_prog_body.asp: shows Progress Indicator in reality.
- show_prog_bottom.asp: (Like Netscape Navigator the browser that does not support Inline Frame
   is required )
[Uploading progress window page(show_prog_body.asp)]
<%@ EnableSessionState=False%>
<%
'The page that shows upload progress situation
Set m_objMon = Server.CreateObject("DEXT.FileUploadMonitor")
m_objMon.ShowMonitor
Set m_objMon = Nothing
%>
[Uploading progress window page(show_prog_bottom.asp)]
<%@ EnableSessionState=False%>
<HTML>
<HEAD>
<STYLE type="text/css">
td {font-size: 9pt }
</STYLE>
</HEAD>
<BODY bgcolor="#d4d0c8" leftmargin="8" topmargin="0" scroll="no">
<TABLE border="0" width="365" cellpadding="2" cellspacing="0" bgcolor="#d4d0c8" ID="Table2">
<TR><TD>Click the <B>STOP</B> button on your browser to abort uploading.</TD></TR>
</TABLE>
</BODY>
</HTML>
According to the ASP page above, the session condition is cancelled by designating
"EnableSessionState" property as False. If the session in this page is not cancelled, Submit
process of Form, that is, the performed result of page can not be shown before finishing file
uploading progress. Therefore be sure to cancel the session condition of page.
ShowMonitor() method shows the uploading progress at each moment and finish window
(or dialog box) automatically after completing upload.
[Uploading process page]
<%@ LANGUAGE="VBSCRIPT"%>>
<HTML>
<BODY>
<%
Set uploadform = Server.CreateObject("DEXT.FileUpload")
uploadform.DefaultPath = "C:\TEMP"
uploadform("file1").Save
Set uploadform = Nothing
%>
</BODY>
</HTML>

File Download
1. File Download
Users can download file in the server through web browser by Download(), DownloadVirtual(),
DownloadBlob() method of FileDownload object .
- Download() : downloads file placed in designated path of server.
- DownloadVirtual(): downloads file placed in the designated virtual path. This exists for
   compatibility with DEXTUpload.
- DownloadBlob() : Downloads BLOB data of database

[Download process page]

<%@ Language=VBScript EnableSessionState="False"%>
<%
filepath = request("filepath")
filename = request("filename")
'Creates download item
Set objDownload = Server.CreateObject("DEXT.FileDownload")
'objDownload.Download(filepath, file name, choice of forced save (True: forced save),
choice of relay download(True: relay download))
objDownload.Download(filepath, filename, true, false)
Set objDownload = Nothing
%>
 
2. Downloading database BLOB
DownloadBlob() method of FileDownload item enables to download database BLOB data
in the server. In case of downloading BLOB field, the relay download is not supported.
[Download process page]

<%@ Language=VBScript EnableSessionState="False"%>
<%
fileid=request("dblist")
Set rs = Server.CreateObject("ADODB.Recordset")
Conn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("/DEXTUploadProsamples") & "\DEXTUpload.mdb"
sql="SELECT * FROM DEXTUPLOAD WHERE fileid ="&fileid
rs.Open sql, Conn, 3, 1
Set objDownload = Server.CreateObject("DEXT.FileDownload")
objDownload.DownloadBlob rs("filedata"), rs("filename"), true
Set objDownload = Nothing
rs.Close
Set rs = Nothing
%>
BLOB Manager
※ The methods related to Database BLOB are as follows.

SaveAsBlob of FileUpload item : upload file and save it in Database BLOB field.
DownloadBlob of FileDownload item: download Database BLOB into user’s disk and save it as file.
SaveFileAsBlob of BLOBManager item : save file existed in the server into Database BLOB field.
SaveBlobAsFile of BLOBManager item: save Database BLOB into disk file of server.
1. Save File in the server into Database BLOB field
The following is the example that save files into database BLOB field.

[ Input form page]

<HTML>
<HEAD>
</HEAD>
<BODY>
<form name="write_form" action="FileToBlob_Process.asp" ID="Form1">
<input type="file" name="file" ID="File1">
<br>
<input type="submit" name="Upload" value="Upload" ID="Submit1">
</form>
</BODY>
</HTML>
In the form tag, enctype = "multipart/form-data" property is not designated.
[ Uploading process page]

<%@ Language=VBScript %>
<%
'Obtain path of file existed in the server
filepath=request("file")
set objBlobMan=server.CreateObject("DEXT.BlobManager")
set fso=server.CreateObject("Scripting.FileSystemObject")
'Obtain file name and size by using file path. The purpose of this is to save not only data and
the name and size of data in the database'
set file=fso.GetFile(filepath)
filesize=file.size
filename=file.name
set fso=nothing
Conn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("/DEXTUploadProsamples")
& "\DEXTUpload.mdb" set rs=server.CreateObject("ADODB.RECORDSET")
sql="select * from DEXTUPLOAD"
rs.Open sql,conn,3,3
rs.AddNew
'Structure of DEXTUPLOAD TABLE
'fileid serial No
'filename text
'filesize number
'filedata OLE item
rs("filename")=filename
rs("filesize")=filesize
'save file existed in the server into Database
objBlobMan.SaveFileAsBlob filepath,rs("filedata")
rs.Update
rs.Close
set rs=nothing
%>
<HTML>
<BODY>
Upload Name: <%=FileName%> <br>
File Size: <%=filesize%> <br>
</BODY>
</HTML>
<%
set objBlobMan=nothing
%>
 
Image Manager
[Creating watermark image]

DEXT.ImageProc have functions such as image watermark, conversion of file format and thumbnail
The code below shows that uploaded image file is changed by image watermark and text watermark.
If the designated file is image file, Set SourceFile() method returns true and initialize image object
<%@ Language=VBScript %>
<%
set uploadform=server.CreateObject("DEXT.FileUpload")
uploadform.DefaultPath="C:\TEMP"
set objImage =server.CreateObject("DEXT.ImageProc")
if true = objImage.SetSourceFile(uploadform("file").TempFilePath) then
'FileNameNoExt property returns the name of uploaded file.(except extension)
SourceFileName = uploadform("file").FileNameNoExt
FileName1 = "C:\Temp\" & SourceFileName & "(Image).jpg"
FileName2 = "C:\Temp\" & SourceFileName & "(Text).jpg"
%>
<HTML>
<BODY>
<!-- The extension of image file watermarked is saved as jpg format internally -->
Save as Watermark Image: <%=objImage.SaveAsWatermarkImage("/DEXTUploadProSamples/Image/WaterMark/
watermark.bmp",FileName1,-10,-10,false)%>
Save as Watermark Text: <%=objImage.SaveAsWatermarkText("WaterMark Text",FileName2,
15,10,10,false)%>
</BODY>
</HTML>
<%
end if
set objImage = nothing
Set uploadform =nothing
%>
[Thumbnail image file]

The code below thumbnails the uploaded image file to 1/10 size. the image created is JPG format.
<%@ Language=VBScript %>
<%
set uploadform=server.CreateObject("DEXT.FileUpload")
uploadform.DefaultPath="C:\TEMP"
set objImage =server.CreateObject("DEXT.ImageProc")
if true = objImage.SetSourceFile(uploadform.TempFilePath) then
%>
<HTML>
<BODY>
Save as Image Thumbnail: <%=objImage.SaveasThumbnail("C:\TEMP\" & uploadform.FileName,objImage.ImageWidth/10,objImage.ImageHeight/10,false)%>
</BODY>
</HTML>
<%
end if
set objImage = nothing
Set uploadform =nothing
%>
[Converting image file format into other format]

The code below is saved by converting JPG into BMP format. It can be converted into other
format such as BMP,JPG,GIF
<%@ Language=VBScript %>
<%
set uploadform=server.CreateObject("DEXT.FileUpload")
uploadform.DefaultPath="C:\TEMP"
set objImage =Server.CreateObject("DEXT.ImageProc")
if true = objImage.SetSourceFile(uploadform.TempFilePath) then
'FileNameNoExt property returns the name of uploaded file.(except extension)
SourceFileName = uploadform("file").FileNameNoExt
FileName1 = SourceFileName & "(Image).bmp"
%>
<HTML>
<BODY>
Convert Image File Format: <%=objImage.ConvertImageFormat("image/bmp",
"C:\Temp\" & FileName1 ,false)%>
</BODY>
</HTML>
<%
end if
set objImage = nothing
Set uploadform =nothing
%>
[Image file information]

This supports various meta data such as exposure time for image file, description of image,
resolution etc.

<%@ Language=VBScript %>
<%
set uploadform=Server.CreateObject("DEXT.FileUpload")
uploadform.DefaultPath="C:\TEMP"
set objImage =Server.CreateObject("DEXT.ImageProc")
if true = objImage.SetSourceFile(uploadform("file").TempFilePath) then
%>
<HTML>
<BODY>
Image Format:<%=objimage.ImageFormat%> <br>
VerticalResolution:<%=objimage.VerticalResolution%> <br>
HorizontalResolution:<%=objImage.VerticalResolution%> <br>
Image Height:<%=objimage.ImageHeight%> <br>
Image Width:<%=objimage.ImageWidth%> <br>
Pixel Format:<%=objimage.PixelFormat%> <br>
Equipment Maker:<%=objImage.MDEquipMake%> <br>
Equipment Model:<%=objImage.MDEquipModel%> <br>
Image Description:<%=objImage.MDImageDescription%> <br>
Image Document Name:<%=objImage.MDDocumentName%><br>
Software Used:<%=objImage.MDSoftwareUsed%> <br>
Artist:<%=objImage.MDArtist%> <br>
Date Time:<%=objImage.MDDateTime%> <br>
Color Space:<%=objImage.MDExifColorSpace%> <br>
Exposed Time:<%=objImage.MDExifExposureTime%> <br
Flash:<%=objImage.MDExifFlash%> <br>
Shutter Speed<%=objImage.MDExifShutterSpeed%> <br>
Iris diaphragm value:<%=objImage.MDExifFNumber%> <br>
</BODY>
</HTML>
<%
else
Response.Write("This is not image file.")
end if
set objImage = nothing
Set uploadform =nothing
%>
Cache File Manager

[Loading file into memory]

If the frequently downloaded files are loaded into memory, the time to read file in disk and load
them into memory can be saved and the function to download can be improved. In the download
cache function, files are loaded into memory. If mass storage file is loaded, be careful that main
memory may be in sufficient. Therefore, in case of the frequently downloaded files, you‘d better
use cache function. The cache function can be performed by DEXT.Manager object.
First, load files into memory by using AddCacheFile() method, import the loaded file list through
For Each window.

The code below is the example that loads file into memory and shows loaded file list.
<%@ Language=VBScript %>
<%
'Add file into memory
objManager.AddCacheFile Trim(Request("txtFilePath1"))
Response.Write("File list loaded in memory<br>")
'Importing 'cached file list
For Each cacheFile in objManager
response.Write(cacheFile & "<br>")
Next
set objManager = nothing
%>
[Deleting designated file from memory]

Delete the unused file from memory and control the memory resources. Using
RemoveCacheFile() method can delete file from memory.

The code below is the example that delete file from memory and shows loaded file list.
<%@ Language=VBScript %>
<%
'Delete 'files from memory
objManager.RemoveCacheFile Trim(Request("txtFilePath1"))
Response.Write("File list loaded in memory<br>")
'Importing Cached file list
For Each cacheFile in objManager
response.Write(cacheFile & "<br>")
Next
set objManager = nothing
%>
 
 
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.