I have a multi select form that retrieves a list of users from a database and upon clicking on them moves them from the left box to the right box. I then want to upload a file and a description of the file up to the database (access) for each user. I have everything working except when I select more than one user it only uploads the first one on the list. I fairly new at this so any help would be really appreciative.
Thanks
Bryon
Here is the code from the form:
<FORM NAME="userslist" METHOD="POST" ENCTYPE="multipart/form-data"
ACTION="ado_upload.asp?<% = PID %>"
OnSubmit="return ShowProgress();">
<CENTER>
<TABLE border=1>
<TR><TD>
<table>
<tr>
<td bgcolor="#cccccc" align="middle" ><b>Available Users</b></td>
<td></td>
<td bgcolor="#cccccc" align="middle" ><b>Selected Users</b></td>
</tr>
<tr>
<td align="left"><!-- onchange="moveit();" -->
<select name="menuitems1" onchange="moveit();" style="WIDTH: 300px" size="10" multiple>
<%
'Loop through the recordset adding each customer to the combo box
Do While Not objRS.EOF
%>
<option value="<%=objRS("UserName"%>">
<%=objRS("CustName"%> -- <%=objRS("CompanyName"%></option>
<%
objRS.MoveNext
Loop
'Close and dereference database objects
objRS.Close
Set objRS = Nothing
%>
</select>
</td>
<td align="middle">
<input type="button" tagName="BUTTON" onclick="removefromcombo();" value=" < < Remove" id="submit2" name="submit2" style="FONT-WEIGHT: bold">
</td>
<td align="left">
<select name="UserName" id="UserName" style="WIDTH: 300px" size="10" multiple>
</select></td></tr><tr><td colspan="3">
File: <INPUT TYPE=FILE NAME="THEFILE" size="20"></p>
<P>
Description: <TEXTAREA NAME="DESCR" rows="1" cols="31"></TEXTAREA><P>
<INPUT TYPE=SUBMIT VALUE="Upload!"></FORM>
----------------------------------
Here is the code from the page that places the data in the DB:
<%
Set Upload = Server.CreateObject("Persits.Upload"
Upload.ProgressID = Request.QueryString("PID"
' we use memory uploads, so we must limit file size
Upload.SetMaxSize 40000000, True
' Save to memory. Path parameter is omitted
Count = Upload.Save
' Obtain file object
Set File = Upload.Files("THEFILE"
If Not File Is Nothing Then
Connect = "DSN=aspupload"
' Use ADO Recordset object
Set rs = Server.CreateObject("adodb.recordset"
' Reopen recordset to insert file
rs.Open "MYIMAGES", Connect, 2, 3
rs.AddNew
rs("image_blob" = File.Binary
rs("filename" = File.FileName
rs("filesize" = File.Size
rs("description" = Upload.Form("DESCR"
rs("UserName" = Upload.Form("UserName"
rs.Update
Response.Write "File saved."
Else
Response.Write "File not selected."
End If
%>
Thanks
Bryon
Here is the code from the form:
<FORM NAME="userslist" METHOD="POST" ENCTYPE="multipart/form-data"
ACTION="ado_upload.asp?<% = PID %>"
OnSubmit="return ShowProgress();">
<CENTER>
<TABLE border=1>
<TR><TD>
<table>
<tr>
<td bgcolor="#cccccc" align="middle" ><b>Available Users</b></td>
<td></td>
<td bgcolor="#cccccc" align="middle" ><b>Selected Users</b></td>
</tr>
<tr>
<td align="left"><!-- onchange="moveit();" -->
<select name="menuitems1" onchange="moveit();" style="WIDTH: 300px" size="10" multiple>
<%
'Loop through the recordset adding each customer to the combo box
Do While Not objRS.EOF
%>
<option value="<%=objRS("UserName"%>">
<%=objRS("CustName"%> -- <%=objRS("CompanyName"%></option>
<%
objRS.MoveNext
Loop
'Close and dereference database objects
objRS.Close
Set objRS = Nothing
%>
</select>
</td>
<td align="middle">
<input type="button" tagName="BUTTON" onclick="removefromcombo();" value=" < < Remove" id="submit2" name="submit2" style="FONT-WEIGHT: bold">
</td>
<td align="left">
<select name="UserName" id="UserName" style="WIDTH: 300px" size="10" multiple>
</select></td></tr><tr><td colspan="3">
File: <INPUT TYPE=FILE NAME="THEFILE" size="20"></p>
<P>
Description: <TEXTAREA NAME="DESCR" rows="1" cols="31"></TEXTAREA><P>
<INPUT TYPE=SUBMIT VALUE="Upload!"></FORM>
----------------------------------
Here is the code from the page that places the data in the DB:
<%
Set Upload = Server.CreateObject("Persits.Upload"
Upload.ProgressID = Request.QueryString("PID"
' we use memory uploads, so we must limit file size
Upload.SetMaxSize 40000000, True
' Save to memory. Path parameter is omitted
Count = Upload.Save
' Obtain file object
Set File = Upload.Files("THEFILE"
If Not File Is Nothing Then
Connect = "DSN=aspupload"
' Use ADO Recordset object
Set rs = Server.CreateObject("adodb.recordset"
' Reopen recordset to insert file
rs.Open "MYIMAGES", Connect, 2, 3
rs.AddNew
rs("image_blob" = File.Binary
rs("filename" = File.FileName
rs("filesize" = File.Size
rs("description" = Upload.Form("DESCR"
rs("UserName" = Upload.Form("UserName"
rs.Update
Response.Write "File saved."
Else
Response.Write "File not selected."
End If
%>