Home     Products      Support      Corporate     Sign In 
Support Knowledge Base, Article 901
Product
FileUp
Version
All versions
Title
Unicode support for FileUp applications in ASP
Problem
Multi-lingual support requires the use of Unicode. This article will explain how to design your FileUp - ASP application to support Unicode.
Solution
To support Unicode while using FileUp in an ASP environment, ensure that the following exists in your code:
  • The HTML
    • In the meta tag, set the charset attribute to UTF-8.
  • In the ASP:
    • Set the Codepage attribute of the page directive to 65001
    • Set the Codepage property of the FileUp object to 65001

The following code demonstrates where these elements should exist in your form and server-side code in an ASP application using FileUp for a simple upload.

The Form (form.htm):

<HTML>
<HEAD>:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</HEAD>

<BODY>
<FORM ACTION="formresp.asp" ENCTYPE="MULTIPART/FORM-DATA" METHOD="POST">

   <P>
   Enter Filename:<br>
   <INPUT TYPE="FILE" NAME="myFile"><BR>
   <I> Click "Browse" to select a file to upload.</I><BR>
   </P>
   <P>
   Enter text in any language<BR>
   <INPUT TYPE="TEXT" NAME="text1"><BR>
   </P>
   <P>
   <INPUT TYPE="SUBMIT" NAME="SUB1" VALUE="Upload File">
   </P>

</FORM>
</BODY>
</HTML>

 

The server-side script (formresp.asp):

<%@ Language=VBScript codepage=65001 %>
<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</HEAD>
<BODY>

<%

  Dim oFileUp

  Set oFileUp = Server.CreateObject("SoftArtisans.FileUp")

  '---Set CodePage property to support unicode
  oFileUp.CodePage = 65001

  oFileUp.Path = "C:\Save Here"

  If Not oFileUp.Form("myFile").IsEmpty Then

    oFileUp.Form("myFile").Save

    Response.Write("<B>File saved successfully on the server as:</B><BR>")
    Response.Write(oFileUp.Form("myFile").ServerName)
    Response.Write("<br><hr>" & oFileUp.Form("text1"))

  Else
    Response.Write("Error: There was no file submitted for upload.")
  End If

  Set oFileUp = Nothing
%>

</BODY>
</HTML>


Related Links:
Created : 8/4/2004 12:43:57 PM (last modified : 8/4/2004 12:43:57 PM)
Rate this article!
Comments