Hej.
Jeg skal uploaded 2 filer og indskrive data fra samme form til en tabel. Mit
problem ligger i at kunne tjekke om det er den ene, den anden eller dem
begge der er uploaded. Jeg har prøvet med følgende 2 forsøg:
<%
SUB do_action()
IF request.querystring("action") = "update" THEN
DIM Upload
DIM g_count
DIM g_pic1
DIM g_pic2
DIM file
DIM up_name
DIM up_desc
DIM up_meth
DIM up_indl
DIM up_enkj
DIM up_enkc
DIM up_prot
DIM up_fat
DIM up_carb
DIM x
DIM up_pic1
DIM up_pic2
x = 0
' Create object and upload file(s)
SET Upload = Server.CreateObject("Persits.Upload.1")
Upload.OverwriteFiles = FALSE
Upload.SetMaxSize 1048576 ' Limit files to 1MB
g_count = Upload.SaveVirtual ("/harboe/images/")
up_name = replace(Upload.form("name"),vbcrlf,"<br>")
up_desc = replace(Upload.form("desc"),vbcrlf,"<br>")
up_meth = replace(Upload.form("meth"),vbcrlf,"<br>")
up_indl = replace(Upload.form("indl"),vbcrlf,"<br>")
up_enkj = replace(Upload.form("enkj"),vbcrlf,"<br>")
up_enkc = replace(Upload.form("enkc"),vbcrlf,"<br>")
up_prot = replace(Upload.form("prot"),vbcrlf,"<br>")
up_fat = replace(Upload.form("fat"),vbcrlf,"<br>")
up_carb = replace(Upload.form("carb"),vbcrlf,"<br>")
'FORSØG 1 PÅ AT TJEKKE OM FILEN ER UPLOADED
IF Upload.Files("pic1").filename <> "" THEN
g_pic1 = Upload.Files("pic1").filename
x = x + 1
ELSE
END IF
IF Upload.Files("pic2").filename <> "" THEN
g_pic2 = Upload.Files("pic2").filename
x = x + 2
ELSE
END IF
'FORSØG 2 PÅ AT TJEKKE OM FILEN ER UPLOADED
IF g_count>0 THEN
IF Upload.form("pic1") <> "" THEN
g_pic1 = Upload.Files("pic1").filename
x = x + 1
END IF
IF Upload.form("pic2") <> "" THEN
g_pic2 = Upload.Files("pic2").filename
x = x + 2
END IF
IF x = 1 THEN
CALL update_dish_with_pic1(request.querystring("dish_id"), up_name,
up_desc, up_meth, up_indl, g_pic1, up_enkj, up_enkc, up_prot, up_fat,
up_carb)
ELSEIF x = 2 THEN
CALL update_dish_with_pic2(request.querystring("dish_id"), up_name,
up_desc, up_meth, up_indl, g_pic2, up_enkj, up_enkc, up_prot, up_fat,
up_carb)
ELSEIF x = 3 THEN
CALL update_dish(request.querystring("dish_id"), up_name, up_desc,
up_meth, up_indl, g_pic1, g_pic2, up_enkj, up_enkc, up_prot, up_fat,
up_carb)
END IF
ELSE
CALL update_dish_without_pic(request.querystring("dish_id"), up_name,
up_desc, up_meth, up_indl, up_enkj, up_enkc, up_prot, up_fat, up_carb)
END IF
Response.redirect "key_dish.asp?dish_id=" & request.querystring("dish_id")
END IF
END SUB
%>
Er der en god løsning???
Mvh
Martin
|