Pure ASP Upload Add On Pack Support Product Page

Solved

Image name being deleted from databse on update

Reported 20 Feb 2012 22:58:14
1
has this problem
20 Feb 2012 22:58:14 Charles Beaudry posted:
I'm using Pure ASP Upload 3 with the add-on pack in a CMS. It is part of a record update page where several fields including the image can be updated. However, when I update a field in the record but leave the original image, it will delete the image name from the database. How do I work around that glitch?

Replies

Replied 21 Feb 2012 20:13:21
21 Feb 2012 20:13:21 Charles Beaudry replied:
Forget it. I solved the problem by doing two things on the update_record page:

1. I created a session variable on the page called session("imagebanner" and pulled the image name from my database.

2. Near the top I changed this code:


MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 201, 1, 100, UploadFormRequest("banner_image")) ' adLongVarChar



to this:


if UploadFormRequest("banner_image") <> "" then
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 201, 1, 100, UploadFormRequest("banner_image")) ' adLongVarChar
	else 
    MM_editCmd.Parameters.Append MM_editCmd.CreateParameter("param5", 201, 1, 100, session("imagebanner")) ' adLongVarChar
	end if 



The result is that if the file upload field is empty, it will take the existing database value (stored in the session variable) and reload it into the database. If the file upload field has a value, it will delete the existing image, upload the new one and use the new file name to update the record.

Hope this helps some of you who've had this issue...

Reply to this topic