|
Other ASP Components/COM Objects
As well as the AspEmail and AspEncrypt
components covered in our e-mail tutorials
we also offer a number of other ASP components
that you can use within your site :
AspUpload
AspUpload allows you to easily upload files to your
hosting account using a normal HTML form. A simple example
of an the html form and upload script are shown below,
for more details on AspUpload please see the authors
web site : www.aspupload.com.
Please note, as AspUpload is being used
within a shared environment the Upload.Save
method, which saves files using an absolute
path, is disabled. You must instead use
Upload.SaveVirtual which takes a virtual
path to the save location, this restricts
upload locations to your own web space only.
Example html form for file uploads :
<HTML>
<BODY>
<FORM METHOD="POST" ENCTYPE="multipart/form-data"
ACTION="process_upload.asp">
File 1:<INPUT TYPE=FILE NAME="FILE1">
<BR>
File 2:<INPUT TYPE=FILE NAME="FILE2">
<BR>
<INPUT TYPE=SUBMIT VALUE="Upload!">
</FORM>
</BODY>
</HTML>
Corresponding upload script that the upload
form posts to (process_upload.asp) :
<%
Set Upload = Server.CreateObject("Persits.Upload.1")
Upload.SaveVirtual "/"
For Each File in Upload.Files
Response.Write "File Uploaded Successfully
: " & File.Path & " "
& File.Size &" bytes"
Next
%>
AspJpeg
AspJpeg allows you to modify images within
your web site with just a few lines of code.
Features include resizing, rotating, sharpening,
cropping, flipping and typing / drawing
over images. AspJpeg supports JPEG, PNG,
BMP and GIF image formats.
A sample AspJpeg sample script is shown below, for
full details of this component and full object reference
please visit the authors site : www.aspupload.com/aspjpeg.html
<%
' Create AspJpeg
object
Set Jpeg = Server.CreateObject("Persits.Jpeg")
' Set path to source
image, in this case an image called 'test.jpg'
in the same folder as the script
Path = Server.MapPath("images")
& "\test.jpg"
' Open source image
Jpeg.Open Path
' Decrease image
size by 50%
Jpeg.Width = Jpeg.OriginalWidth / 2
Jpeg.Height = Jpeg.OriginalHeight / 2
' Optional: apply
sharpening
Jpeg.Sharpen 1, 150
' Save modified
image to disk as 'test_small.jpg
Jpeg.Save Server.MapPath("images")
& "\test_small.jpg"
%>
|