Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Update

Status
Not open for further replies.

conceptmgt

IS-IT--Management
Sep 12, 2001
45
GB
Hi

This has been annoying me for ages. I have a form with 2 images. When someone updates the second image and not the first it replaces the first image with the new second image.

It is because I use For Each File In Uploader.Files.Items has anyone got idea how I could get around this.

Thanks

Gary

'---------------The Form-------------------------
<%
If not rs(&quot;imagepath1&quot;)=&quot;&quot; then
response.write(&quot;<img src=&quot;&quot; else
response.write(&quot;<img src=Images/Image.gif width=90 height=90>&quot;)
end if
response.write(&quot;<input type=hidden name=imagepath1 value=&quot;&rs(&quot;imagepath1&quot;)&&quot;>&quot;)
%>

<input name=&quot;image1&quot; type=&quot;file&quot; size=&quot;10&quot;>


'---------------Get Images-----------------------
For Each File In Uploader.Files.Items

File.SaveToDisk &quot;C:\\Inetpub\\
ReDim Preserve arrImages(i)
arrImages(i) = File.FileName

i = i + 1

delFileName = Uploader.form(&quot;imagePath&quot;&i)

If not delFileName = &quot;&quot; then
Set objFSO = CreateObject(&quot;Scripting.FileSystemObject&quot;)
objFSO.DeleteFile(&quot;c:/inetpub/ Set objFSO = Nothing
End if
Next

'---------------Update Table-----------------------
Set Conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
Set RS = Server.CreateObject(&quot;ADODB.Recordset&quot;)

Conn.open strconnect

strsql = &quot;UPDATE Newsletter&quot;
strsql = strsql + &quot; SET NewsletterName='&quot;& newsName &&quot;', emailFrom='&quot;& Uploader.Form(&quot;from&quot;) &&quot;'&quot;

k = 0
For Each File In Uploader.Files.Items
strsql = strsql + &quot;, imagepath&quot;&k+1&&quot;='&quot;&arrImages(k)&&quot;'&quot;
k=k+1
Next

strsql = strsql + &quot; Where newsletterID LIKE &quot;&newsletterID&&quot;&quot;

Set RS = Conn.Execute(strsql)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top