<%
sub del_file(fn)
  on error resume next
  dim fobj,picc,upload_path
  picc=fn
  upload_path=joekoe_cms.web_var(web_upload,1)
  if len(picc)>3 then
    if int(instr(1,picc,"://"))=0 then
      if left(picc,1)<>"/" then
        if right(upload_path,1)<>"/" then upload_path=upload_path&"/"
        picc=server.mappath(upload_path&picc)
      else
        picc=server.mappath(picc)
      end if
      set fobj = createobject("scripting.filesystemobject")
      fobj.deletefile(picc)
      set fobj = nothing
    end if
  end if
end sub

sub upload_del(unsort,iid)
  dim drs,dsql,picc,fobj,dupload_path
  dupload_path=web_dim(13)
  if right(dupload_path,1)<>"/" then dupload_path=dupload_path&"/"
  set fobj=createobject("scripting.filesystemobject")
  dsql="select url from upload where nsort='"&unsort&"' and iid="&iid&" order by id"
  set drs=joekoe_cms.exec(dsql,1)
  do while not drs.eof
    picc=drs("url")
    if instr(1,picc,"://")=0 and len(picc)>3 then
      if left(picc,1)<>"/" then
        picc=dupload_path&picc
      end if
      if fobj.fileexists(server.mappath(picc)) then
        fobj.deletefile(server.mappath(picc))
      end if
    end if
    drs.movenext
  loop
  drs.close
  set drs=nothing
  set fobj = nothing
  call joekoe_cms.exec("delete from upload where nsort='"&unsort&"' and iid="&iid,0)
end sub

sub upload_note(ns,iid)
  dim ddim,i,sql,upid
  upid=trim(request.form("upid"))
  if upid="" then exit sub
  if left(upid,1)="," then upid=right(upid,len(upid)-1)
  ddim=split(upid,",")
  for i=0 to ubound(ddim)
    if isnumeric(ddim(i)) then
      call joekoe_cms.exec("update upload set iid="&iid&",nsort='"&ns&"',types=1 where id="&ddim(i),0)
    end if
  next
  erase ddim
end sub
%>