Click here to Skip to main content
15,915,163 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please can someone tell me how to delete a pdf from an application folder and from database.

I am able to add the pdf in application folder and into database, but I dont know how to do the deletion.

Please help me out.

Thanks
Posted
Updated 19-Apr-11 21:28pm
v2
Comments
Sandeep Mewara 20-Apr-11 2:33am    
Share the code you have written.

Further, you get any error while deleting?
Dalek Dave 20-Apr-11 3:29am    
Edited for Grammar, Syntax and Readability.

I don't know what you mean by the application folder, but if it is a regular folder on your hard drive just use:
File.Delete()


And to delete a record from the database, just use the following SQL statement:
SQL
delete from "tablewithpdfs"

where "columnname" = "pdfname"
 
Share this answer
 
Comments
Dalek Dave 20-Apr-11 3:29am    
Yep, that'll do it!
String strPath = Server.MapPath("filename");

System.IO.File.Delete(strPath);

This will delete from folder..
And if you store the path in sqlserver then delete the path with delete coment.

Hope this can help you.
 
Share this answer
 
If you have a file in a database and in a file system at the same time, it would be a huge mistake. What do you mean "file in database"? Just a path name of it? That it's OK. The problem would be a lack of transactional behavior.

Just a note.

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900