weee
09-01-2004, 03:20 PM
How can I upload more then one file using AspJpeg?
I have the code to upload file but when I'm trying to upload more then one it's getting all messed up. Here it is:
Set Upload = Server.CreateObject("Persits.Upload")
Upload.OverwriteFiles = False
Upload.SetMaxSize 3000000, True
Count = Upload.Save("D:\users\domain\html\Upload\")
If Err <> 0 or Count = 0 Then
If Err <> 0 Then
Response.Write "<font color=#ff0000>An error occurred: " & Err.Description
Else
Response.Write "Nothing has been uploaded.</font><br><a href=products.asp>Try again</a>."
End If
Else
On Error Goto 0
Set File = Upload.Files(1)
If File.ImageType = "UNKNOWN" Then
File.Delete
Response.Write "<font color=#ff0000>This is not a valid image file.</font><br><a href=products.asp>Try again</a>."
Else
TNheight = 100
productHeight = 200
Height = File.ImageHeight
Width = File.ImageWidth
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Path = Server.MapPath("../../Upload") & "/" & File.ExtractFileName
Jpeg.Open Path
Jpeg.OpenBinary Upload.Files(1).Binary
Jpeg.PreserveAspectRatio = True
Jpeg.Height = TNheight
Jpeg.Width = Width * TNheight / Height
Jpeg.Save "D:\users\domain\html\Upload\" & File.Filename
End If
End If
Thanks!
I have the code to upload file but when I'm trying to upload more then one it's getting all messed up. Here it is:
Set Upload = Server.CreateObject("Persits.Upload")
Upload.OverwriteFiles = False
Upload.SetMaxSize 3000000, True
Count = Upload.Save("D:\users\domain\html\Upload\")
If Err <> 0 or Count = 0 Then
If Err <> 0 Then
Response.Write "<font color=#ff0000>An error occurred: " & Err.Description
Else
Response.Write "Nothing has been uploaded.</font><br><a href=products.asp>Try again</a>."
End If
Else
On Error Goto 0
Set File = Upload.Files(1)
If File.ImageType = "UNKNOWN" Then
File.Delete
Response.Write "<font color=#ff0000>This is not a valid image file.</font><br><a href=products.asp>Try again</a>."
Else
TNheight = 100
productHeight = 200
Height = File.ImageHeight
Width = File.ImageWidth
Set Jpeg = Server.CreateObject("Persits.Jpeg")
Path = Server.MapPath("../../Upload") & "/" & File.ExtractFileName
Jpeg.Open Path
Jpeg.OpenBinary Upload.Files(1).Binary
Jpeg.PreserveAspectRatio = True
Jpeg.Height = TNheight
Jpeg.Width = Width * TNheight / Height
Jpeg.Save "D:\users\domain\html\Upload\" & File.Filename
End If
End If
Thanks!