<% 'Write this form to db on error resume next path = "photocap/" & year(nowcalibrate) & "-" & month(nowcalibrate) & "-" & day(nowcalibrate) & "/" uploadpath = "../" & path localpath = server.mappath(uploadpath) & "\" 'response.write localpath Set fso = Server.CreateObject("Scripting.FileSystemObject") if not fso.folderexists(localpath) then fso.createfolder(localpath) end if if not fso.folderexists(localpath) then response.write "Sorry, folder creation fail! (" & localpath & ")" response.end end if set fso = nothing Set Upload = Server.CreateObject("Persits.Upload") ' We must call Upload.Save or SaveToMemory before we can use Upload.Form! Upload.SetMaxSize 900000, True Upload.OverwriteFiles = false tmpuplcount = Upload.SaveVirtual(uploadpath) If Err.Number = 8 Then Response.Write "Your file is too large. Please try again." else 'Request Data band_id = Upload.form("band_id") band_name = Upload.form("band_name") band_describe = Upload.form("band_describe") grp_id = Upload.form("grp_id") if err then ErrMSG = err.description err.clear else if tmpuplcount > 0 then ErrMsg = "Upload OK.
" For Each File in Upload.Files 'Check the file extension. If not GIF, JPG, BMP, or PNG do not display size Ext = UCase(Right(File.ExtractFileName, 3)) If Ext = "GIF" or Ext = "JPG" or Ext = "BMP" or Ext = "PNG" or Ext = "PSD" or Ext = "EPS" Then ErrMsg =ErrMsg & uploadpath & File.ExtractFileName & " (" & _ File.ImageWidth & " x " & File.ImageHeight & ")
" 'ADD RECORD previewImage = uploadpath & File.ExtractFileName qryimg ="update bands set band_name='" & encode(band_name) & "', band_describe = '"& encode(band_describe) &"', band_picture='" & encode(path & File.ExtractFileName) & "', band_picturex='" & encode(File.ImageWidth) & "', band_picturey='" & encode(File.ImageHeight) & "', grp_id=" & grp_id & " where band_id = "& band_id &"" response.write qryimg 'response.end Set rsImg = conn.execute(qryimg) Else ErrMsg =ErrMsg & uploadpath & File.ExtractFileName & " is not an image.
" End If Next else ErrMsg = "No file to be uploaded." 'ADD RECORD qrynoimg ="update bands set band_name='" & encode(band_name) & "', band_describe = '"& encode(band_describe) &"', grp_id=" & grp_id & " where band_id = "& band_id &"" response.write qrynoimg 'response.end Set rsnoImg = conn.execute(qrynoimg) end if end if 'response.write ErrMsg set rsnoImg = nothing set rsImg = nothing set rsIcon = nothing set Upload = nothing response.write "" end if %>