Forums

ASP

This topic is locked

Pure ASP Upload add-on pack

Posted 08 Dec 2003 22:54:42
1
has voted
08 Dec 2003 22:54:42 Mark Bieganek posted:
I was hoping that the Pure ASP Upload Add-on pack that I just purchased would have the ability to delete pictures from a record without having to delete the whole record or upload a new picture.

For example, lets say that I have a database table with an ID, Title, Description and Picture field. The user is updating the site themselves using ASP pages, web forms and Pure ASP Upload. They have already uploaded a picture, but now want to delete the picture from the record, but want to keep the record intact. To achieve this goal, I have built a page that simply shows the currently uploaded image, and has a hidden field named "Picture" with a value of "". The page acts as an Update page.

I have used this method for a long time, but the obvious problem is that the picture remains on the server when the user clears the link to it from the database.

I purchased the Add-On pack in the hopes that I could apply it to my old page and it would delete the old picture before clearing the "Picture" field in the database.

However, from what I can tell, the only way to delete pictures is to A) Delete the whole record, or B) Upload another picture.

Is there a way to use this extension with my old page?

Thanks!
Mark

Replies

Replied 09 Dec 2003 13:07:30
09 Dec 2003 13:07:30 Patrick Woldberg replied:
The add-on does not support this indeed, it is however something that would be very usefull in the extension and I think we should try to put this in one of the coming updates. I will at this feature to the request list.

Only way to do it now is script it by hand, isn't very difficult when you know ASP

--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Manager at DMXzone.com
--------------------------------------------------
Replied 09 Dec 2003 15:32:48
09 Dec 2003 15:32:48 Mark Bieganek replied:
I do know my way around ASP well enough to handle some hand coding. Do you have any place in mind that can help me to get started?

Thanks,
Mark
Replied 09 Dec 2003 16:24:37
09 Dec 2003 16:24:37 Patrick Woldberg replied:
First you need to read the file out of the database, create a simple recordset for this.
Depending on if you store the full path in the database or not you should do a different action.

To delete file:
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject"
fullFile = Server.MapPath("upload/" & rsRecord.Fields.Item("file".Value)
if fso.FileExists(fullFile) then
fso.DeleteFile(fullFile)
end if

the "upload/" & can be left away if full path is stored. Together with the update record which removes the entree from the database it should work.

It is just a fast answer, but hope it helps you with finding the right solution. Code could be a bit nicer.

--------------------------------------------------
Patrick Woldberg
Web Developer at Dynamic Zones
Manager at DMXzone.com
--------------------------------------------------
Replied 09 Dec 2003 16:34:56
09 Dec 2003 16:34:56 Mark Bieganek replied:
Thanks for the tips, I think that FSO should work just fine, and I have used it before. Not sure why I didn't think of it in this case, but that is what you get paid the big $$ for, right? <img src=../images/dmxzone/forum/icon_smile_big.gif border=0 align=middle>

Thanks Again,
Mark

Reply to this topic