Hi

Hope someone can help. It's just something tricky I think...

I have:
- a form with 5 File fields
- an 'upload' directory where the uploaded files are put in
- an Access DB with 5 colums for the name of each file (ex. pr_foto,
pr_fiche_nl, pr_fiche_fr, pr_fiche_en, pr_fiche_du)

When I upload 5 files everything works fine, but when I upload let's say 2
files, I have a problem.

e.g.
field 1 = "pic.jpg"
field 2 = empty
field 3 = empty
field 4 = empty
field 5 = "du.xls"

Uploading is no problem on itself (files are uploaded), but rather the
position of the filenames in the DB.
I got:
pr_foto = "pic.jpg"
pr_fiche_nl = "du.xls"
pr_fiche_fr = empty
pr_fiche_en = empty
pr_fiche_du = empty

And I want to have the appropriate file in the right colum.... Which means I
want:
pr_foto = "pic.jpg"
pr_fiche_nl = empty
pr_fiche_fr = empty
pr_fiche_en = empty
pr_fiche_du = "du.xls"

Thank you
Flokke




This is my upload file:

<%
Server.ScriptTimeout = 600
response.Buffer = True

Set Upload = Server.CreateObject("Persits.Upload.1")
Upload.OverwriteFiles = False
Upload.Save "C:\web\xxxxxx.com\wwwroot\uploads"

dim filenaam(5), shortfilenaam(5)

aantal = 0
For Each File in Upload.Files

aantal = aantal +1

filenaam(aantal) = File.Path

Next

cat = Upload.Form("f_cat")
pn_nl = Upload.Form("f_pn_nl")
pn_fr = Upload.Form("f_pn_fr")
pn_en = Upload.Form("f_pn_en")
pn_du = Upload.Form("f_pn_du")
pi_nl = Upload.Form("f_pi_nl")
pi_fr = Upload.Form("f_pi_fr")
pi_en = Upload.Form("f_pi_en")
pi_du = Upload.Form("f_pi_du")


for x = 1 to aantal
temp = len(filenaam(x))
temp = temp - 33
shortfilenaam(x) = right(filenaam(x), temp)
if shortfilenaam(x) = "" then
shortfilenaam(x) = "geen fiche"
else
end if
Next

sConnString = "DSN=xxxxx;UID=;Password=;"

Set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open sConnString

Set ObjCmd = Server.CreateObject("ADODB.Command")
objCmd.ActiveConnection = objConn

objCmd.CommandText = "INSERT INTO producten (pr_cat_id, pr_naam, pr_naam_fr,
pr_naam_en, pr_naam_du, pr_nota, pr_nota_fr, pr_nota_en, pr_nota_du,
pr_foto, pr_fiche_nl, pr_fiche_fr, pr_fiche_en, pr_fiche_du) VALUES ('" &
Replace(cat, "'", "''") & "', '" & Replace(pn_nl, "'", "''") & "', '" &
Replace(pn_fr, "'", "''") & "', '" & Replace(pn_en, "'", "''") & "', '" &
Replace(pn_du, "'", "''") & "', '" & Replace(pi_nl, "'", "''") & "', '" &
Replace(pi_fr, "'", "''") & "', '" & Replace(pi_en, "'", "''") & "', '" &
Replace(pi_du, "'", "''") & "', '" & Replace(shortfilenaam(1), "'", "''") &
"', '" & Replace(shortfilenaam(2), "'", "''") & "', '" &
Replace(shortfilenaam(3), "'", "''") & "', '" & Replace(shortfilenaam(4),
"'", "''") & "', '" & Replace(shortfilenaam(5), "'", "''") & "')"

objCmd.CommandType = 1
set oRS = objCmd.Execute

response.redirect ("menu.asp")

%>