Hi all, I have the following code that i have created to change a image file name or file names of certain images selected. Just calling the movefile method to rename them. I had a problem with the response buffer being exceded when I tried to rename 3 images at once. Not sure if that is solved, but i did change it so 3 images now work. The problem still however, i know there is a error or problem with the code. I have a table set up to monitor users online that just monitors session states and updates itself. Can be seen here http://upqt.com/usersonline.asp Now this table is cleared when i update a image name, telling me there is some error hapening that asp is not reporting to me that is clearing all the sessions on the site which then clears the table with session onEnd. Is there anything in this sniplet that would cause all sessions on the site to stop and start again? Asumptions for code: -all variables are working, and calling from the form -the code works and updates the database and filenames properly -the sessions and session variables are all cleared during this part of the code for some reason -there was a response buffer problem that I had to change to a 2 page set up to aleviate but may not be completly fixed. -the problem seems random as it sometimes does not occur. varDir = request.querystring("dir") varSort = request.querystring("sort") varAction = request.form("submitAction") npage = request.queryString("page") varImages = request.form("image") if varImages = "" then varImages = request.queryString("image") End if If varImages <> "" then Set objComm = Server.CreateObject("ADODB.Command") Set objRs = Server.CreateObject("ADODB.Recordset") 'objRs.CursorLocation = 3 arrimages = Split(varImages, ",") varError = 0 If varAction = "Confirm" then For Each i in arrimages mySql = "SELECT ImageName, ImageExtention, userid FROM images WHERE ImageId='" & trim(i) & "'" objRs.Open mySql, Conn ImageName = objRs("ImageName") ImageExt = objRs("ImageExtention") userid = objRs("userid") objRs.Close strName = "text"&trim(i) iName = request.form(strName) if iName <> ImageName then mySql = "SELECT ImageId FROM images WHERE userid='" & userid & "' AND ImageName='" & iName & "'" objRs.Open mySql, Conn If objRs.Eof then Set FSO = Server.CreateObject("Scripting.FileSystemObject") fso.MoveFile "C:\Inetpub\vhosts\upqt.com\httpdocs\users\" & userid & "\" & ImageName & ImageExt, "C:\Inetpub\vhosts\upqt.com\httpdocs\users\" & userid & "\" & iName & ImageExt fso.MoveFile "C:\Inetpub\vhosts\upqt.com\httpdocs\users\" & userid & "\thumbs\" & ImageName & ".jpg", "C:\Inetpub\vhosts\upqt.com\httpdocs\users\" & userid & "\thumbs\" & iName & ".jpg" fso.MoveFile "C:\Inetpub\vhosts\upqt.com\httpdocs\users\" & userid & "\battles\" & ImageName & ".jpg", "C:\Inetpub\vhosts\upqt.com\httpdocs\users\" & userid & "\battles\" & iName & ".jpg" Set FSO = Nothing mySql = "UPDATE images SET ImageName='" & iName & "' WHERE ImageId='" & trim(i) & "'" objComm.ActiveConnection = Conn objComm.CommandText = mySQL objComm.Execute Else varError = varError + 1 End If objRs.close Else varError = varError + 1 End If x=x+1 Next response.redirect "myimages.asp?sort=" & varSort & "&dir=" & varDirPage & "&page=" & npage End If Code (markup): Any help appreciated. Been banging my head against the wall on this one for a while as there is no Error to go from. If anyone would like access to the account to see the problem first hand, i can give them the user name and password for here to see the problem. http://upqt.com/login.asp
in the query, you're using i as image number while i is the counter of arrimages. arrimages is a split of varImages. so, both following values will provide same results: varImages="a,b,c" varImages="b,c,a" while these 2 are differents.
This is a for each loop, should "i" not be equal to the value of the array in that spot? In your example the two varImages would be the same result, as its not concered about order, just checking the image name and such for the imageID. The variable i does have the correct image id in it as i stated the results work but i get a response buffer problem when i run more than 2 images. Then all sessions clear. I may try just turning this into a for LBound to UBound of the array and see what that does. Thanks and any other ideas are welcome.
Thats the oddest part. No error is reported. The code runs and changes the file names and works. No Error line. The error happens behind the scenes i think. What happens is if i edit or delete multiple images, the asp Application restarts and all user session variables are cleared. The editing of the images works but still craps out the application. Quite honestly the most anoying problem i have ever had.