ByteArray - Convert data from BinaryRead to string ByteArray - Save the posted data. ByteArray - Fill byte array by a random data ByteArray - ASP download Advapi - Logon and impersonate user Advapi - RevertToSelf sample ASP timing Simple download Multiple files download with on-the-fly compression zip/arj ByteArray - HexString sample INI and integer value Timing informations. Kernel - Sleep for 2second Kernel - Get command line Kernel - Get name of the local computer Kernel - Get current directory Kernel - Kernel and user time taken by process. Kernel - Kernel and user time taken by current thread. Kernel - Get all envinronment strings. Kernel - One of the environment variable Kernel - Write temporary directory path Kernel - TickCount Write system variables. Same ASP sample with PureASP upload ZLib - Compress file Transfer compressed file from client to server using IE (special upload) ZLib - Accept compressed data on server-side ASP Kernel - Get exact consumed time of VBS function Kernel - Get exact duration of a VBS function using msPerformanceCounter LogFile - Get current path to the log file. LogFile - Specify one log file per week. LogFile - Sample ASP log of variant arguments. LogFile - Delete log file LogFile - String to log as one line LogFile - DateTimeFormat sample LogFile - Local/GMT date/time values LogFile - Sample of values on begin of line. LogFile - Encode values LogFile - Separator of logged values LogFile - Log some array value LogFile - Description of log file fields LogFile - Define comment on the beggining of file LogFile - Samples of Log method LogFile - Simple log file sample Set task priority in MS SQL Upload - Count and enumarate form fields, text fields and files. Upload - Enumerate source files and write file names Upload - Save extra upload info to a database Upload - Read short source data in one block Upload - Store up to 1MB data in memory Upload - Do not upload data greater than 1MB. Upload - Custom temporary folder Upload - Enumerate text fields in a form. Upload - Write source form data along with form fields Upload - Switch page using form state Upload - Enumerate source fields using index Upload - Save all source files to the specified path Upload - Count number of source fields with a specified name Upload - Write contents of all text form fields Upload - Use x-mac-ce code page for form data. Upload - Write names of all form fields Upload - Save source fields to different loactions Upload - Save form files with special name. Upload - Simple upload to database Upload - Upload of large files to database using AppendChunk method of RecordSet Upload - large files to MS SQL Server using a HexString property and UPDATETEXT SQL statement Upload - Simple upload Upload - use unicode (utf-8) character set for request/response data Convert string between windows-1250 and iso-8859-2 (or utf-8) charsets, ASP Multiselect fields (non-unique field names) Upload - Using a HexString property and Insert statement POST, ASPForm - Work with original posted data. Upload - Progress bar concept. Web browrser (IE/NN) does not accept response data when uploading. So there is one another way to show progress bar during upload - open a new client browser window with another server script on begginning of upload and access current uploading form from the second server script (task).
These two server upload tasks are join using
ScriptUtils.
ASPForm.
UploadID property (in the uploading task) and
ScriptUtils.
ASPForm.
getForm property (progress bar task). You can use
ScriptUtils.
ASPForm.
NewUploadID property to get unique upload ID, or you can get this ID by any other way (for example, using rnd() function).
Upload - upload with ie-style progress bar. Upload - Send an email with attachment Upload - Use ASPForm object in VB6 class Upload - Form parser and VBA 6 Upload - progress bar, number and percent of completted Upload - get new upload ID for upload and progress script Simple Item sample CompareMode sample ASP - Share application variables ScriptUtilities MultiDictionary lets you share variables (text, numbers, objects) in one process. This is idea sample to share ASP (ASPNet) Application objects between two or more IIS applications. You can share any type of variables - strings, numeric, arrays, objects with a top performance.
You can also use
Access ASP Application object from a remote script article (without external components). This article lets you share strings/numeric variables over internet (other ASP apps on the same or remote machine, VBS scripts).
Count property sample Exists method sample Remove method sample - nonunique keys Change a key. Enumerate Multi.
Dictionary keys and items
Field CharSets - handle form fields in different code pages Multipart - enumerate field headers Download of large files in ASP Upload - Save only images Kernel - copy file ByteArray - Convert iso-2022-jp binary data to shift-jis codepage binary data ByteArray - decode and encode from Base64 ByteArray - encode a file to a base64 string (Base64 file) You can simply encode a binary or text file to a Base64 string using this sample code. The base64 string can be stored to a file using
SaveAs method.
ByteArray - Decode a Base64 string to a binary data. Upload - cause read when source data exceeds a limit Convert files from one code page / character set to another (ANSI to utf-8) ASP Form - process standard x-www-form-urlencoded data with unicode code page and unlimitted size.
This sample demontrates accepting of a plain form (Form without ENCTYPE="multipart/form-data") by Huge-ASP file upload, ASPForm Object. Full source is in form-url-encode-utf-8.asp sample file.
ASPForm object has some great functionality against of Request.Form: size limit for ASPForm object is 2GB. Request.Form(...) can accept maximum of 100kB.
ASPForm acepts ANY code page. This page is written in utf-8. It lets you write and mix some special character sets and characters
such are hebrew (קבוצות דיון), arabic (مجموعات), east-european (žluÅ¥ouÄký kůň), russian (Картинки), japanese (イメージ) or chinese (圖片).
You can have the characters NOT only in HTML page, you can use them in input fields, of course. ASPForm accepts application/x-www-form-urlencoded and multipart/related data and contains automatic detection of type of a source form.
|
Upload - Check file contents to ensure the field is really an image This function checks the uploaded file contents to ensure that the file is an image. You can check extension of the file or content-type. If the content-type begins with 'image/' or extension is in imageExts, the file is probably an image.
But - someone can rename an .exe file and send the file as 'image'. So a second part of the check function tests file contents for usual characteristics of image files. You can use
String or
HexString property to get a part of contents of the file and compare it with image file characteristics.
You can use this function to check other file types (compressed, executable, …) also.
These tables are from
Richard Ogley's pages.
Jump to:
Image files |
Compressed files |
Archive files |
Executable files |
Miscellaneous files
File type | Typical extension |
Hex digits xx = variable |
Ascii digits . = not an ascii char |
Bitmap format |
.bmp |
42 4d |
BM |
FITS format |
.fits |
53 49 4d 50 4c 45 |
SIMPLE |
GIF format |
.gif |
47 49 46 38 |
GIF8 |
Graphics Kernel System |
.gks |
47 4b 53 4d |
GKSM |
IRIS rgb format |
.rgb |
01 da |
.. |
ITC (CMU WM) format |
.itc |
f1 00 40 bb |
.... |
JPEG File Interchange Format |
.jpg |
ff d8 ff e0 |
.... |
NIFF (Navy TIFF) |
.nif |
49 49 4e 31 |
IIN1 |
PM format |
.pm |
56 49 45 57 |
VIEW |
PNG format |
.png |
89 50 4e 47 |
.PNG |
Postscript format |
.[e]ps |
25 21 |
%! |
Sun Rasterfile |
.ras |
59 a6 6a 95 |
Y.j. |
Targa format |
.tga |
xx xx xx |
... |
TIFF format (Motorola - big endian) |
.tif |
4d 4d 00 2a |
MM.* |
TIFF format (Intel - little endian) |
.tif |
49 49 2a 00 |
II*. |
X11 Bitmap format |
.xbm |
xx xx |
|
XCF Gimp file structure |
.xcf |
67 69 6d 70 20 78 63 66 20 76 |
gimp xcf |
Xfig format |
.fig |
23 46 49 47 |
#FIG |
XPM format |
.xpm |
2f 2a 20 58 50 4d 20 2a 2f |
/* XPM */ |
File type | Typical extension |
Hex digits xx = variable |
Ascii digits . = not an ascii char |
Bzip |
.bz |
42 5a |
BZ |
Compress |
.Z |
1f 9d |
.. |
gzip format |
.gz |
1f 8b |
.. |
pkzip format |
.zip |
50 4b 03 04 |
PK.. |
File type | Typical extension |
Hex digits xx = variable |
Ascii digits . = not an ascii char |
TAR (pre-POSIX) |
.tar |
xx xx |
(a filename) |
TAR (POSIX) |
.tar |
75 73 74 61 72 |
ustar (offset by 257 bytes) |
File type | Typical extension |
Hex digits xx = variable |
Ascii digits . = not an ascii char |
MS-DOS, OS/2 or MS Windows |
|
4d 5a |
MZ |
Unix elf |
|
7f 45 4c 46 |
.ELF |
File type | Typical extension |
Hex digits xx = variable |
Ascii digits . = not an ascii char |
pgp public ring |
|
99 00 |
.. |
pgp security ring |
|
95 01 |
.. |
pgp security ring |
|
95 00 |
.. |
pgp encrypted data |
|
a6 00 |
¦. |
ByteArray - accept very large data in POST/PUT request, ASP, VBScript Upload - handle other requests with higher priority ByteArray - Punycode - unicode conversions Short functions to encode/decode string<->punycode data. You can use these functions as an Internationalized Domain Names VBScript converter.
punycode to unicode conversion
unicode string to punycode conversion
IDN string to unicode conversion
unicode string to IDN string conversion
See Live punycode idn decoder/encoder.
ByteArray - save unicode data (string) as utf-8 with BOM
ByteArray, T-SQL - base64 encoder for Microsoft SQL This short sample lets you convert any string data to Base64 directly in SQL stored procedure (SP written in MS T-SQL). The data are passed as a string, you can do String-to-binary conversion with specified charset (the default charset is specified by system locale). The binary data are converted by get_Base64 property.
See also ByteArray, T-SQL - base64 decoder for Microsoft SQL
ByteArray, T-SQL - base64 decoder for Microsoft SQL This short sample lets you convert a Base64 string data to a decoded String or Binary data directly in SQL stored procedure (SP written in MS T-SQL). The data are passed as a Base64 string, then you can get the original data as a binary/image data type or converted to unicode string using specified charset/code page. The data are converted by put_Base64 property.
See also ByteArray, T-SQL - base64 encoder for Microsoft SQL