Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.1
|
ASP.NET 1.1 As of 10/6/2005, this forum is locked as part of the reorganization described here: http://p2p.wrox.com/topic.asp?TOPIC_ID=35394. No posts have been deleted. Open ongoing discussions from the last week have been moved to either ASP.NET 1.0 and 1.1 Beginners http://p2p.wrox.com/asp-net-1-0-1-1-basics-60/ or ASP.NET 1.0 and 1.1 Professional. http://p2p.wrox.com/forum.asp?FORUM_ID=50. See my sticky post inside for more.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.1 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 11th, 2004, 10:01 PM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to delete image from server using VB & ASP.NET

I have succesfully uploaded image file to server.
What do I use to delete file from server I have uploaded.




 
Old September 11th, 2004, 11:02 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

System.IO.File.Delete()
 
Old September 12th, 2004, 05:53 AM
Friend of Wrox
 
Join Date: Jun 2004
Posts: 245
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I found this example in MSDN. Is this only for text files or can I also use this to delete image files?????
I noticed that in this example it creates new text file then copy content of older text file then deletes the new one. Why????


The following example deletes a file from the specified path.

[Visual Basic]
Imports System
Imports System.IO
Imports System.Text

Public Class Test
    Public Shared Sub Main()
        Dim path As String = "c:\temp\MyTest.txt"
        Try
            Dim sw As StreamWriter = File.CreateText(path)
            sw.Close()
            Dim path2 As String = path + "temp"

            ' Ensure that the target does not exist.
            File.Delete(path2)

            ' Copy the file.
            File.Copy(path, path2)
            Console.WriteLine("{0} was copied to {1}.", path, path2)

            ' Delete the newly created file.
            File.Delete(path2)
            Console.WriteLine("{0} was successfully deleted.", path2)

        Catch e As Exception
            Console.WriteLine("The process failed: {0}", e.ToString())
        End Try
    End Sub
End Class








Similar Threads
Thread Thread Starter Forum Replies Last Post
How to get Image from sql Server in Asp.net akumarp2p C# 2005 1 February 22nd, 2007 09:51 AM
ASP.Net & SQL Server chenwf2006 ASP.NET 2.0 Basics 0 December 17th, 2006 03:54 AM
Unavailable download code for VB.Net & SQL Server bamboat_3 VB.NET 2 September 2nd, 2004 09:34 AM
Add & delete in vb.net myriam Pro VB.NET 2002/2003 1 August 17th, 2003 07:49 PM
Portal ASP.NET C# & VB.NET warrenla Wrox Book Feedback 0 July 14th, 2003 07:12 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.