Help deleting thumbnails

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Help deleting thumbnails

    Hi Folks,

    I'm trying to delete 2 files using fso. The mail file name is stored in an
    access db.
    using the code below I can delete the main file but not the thumbnail.

    The thumbnail has the same file name plus the suffix "_small" so if the main
    file
    is called "mypicture.jpg" the thumbnail is called "mypicture_small.jpg"

    The main file is being deleted but no matter how I try I cannot get the
    thumbnail
    deleted. They are both in the same folder with the same permissions.

    Can anyone shed any light on why this doesn't work?


    Dan



    Dim Photo, PhotoSmall
    Photo= Rs_photo.Fields.Item("Photo_name").Value
    PhotoSmall = Left(Photo, Len(Photo)-4)
    PhotoSmall = PhotoSmall & "_small" & Right(Photo,4)

    Set File = CreateObject("Scripting.FileSystemObject")
    ImagePath = Server.MapPath("..\images\M_photos")
    ImagePath2 = Server.MapPath("..\images\M_photos")
    ImagePath = ImagePath & "\" & Photo
    ImagePath2 = ImagePath & "\" & PhotoSmall

    ' check if file exists and if true delete the file
    If fileExists(ImagePath) Then
    File.DeleteFile(ImagePath)
    End if
    If fileExists(ImagePath2) Then
    File.DeleteFile(ImagePath2)
    End if


    Me Guest

  2. Similar Questions and Discussions

    1. Thumbnails
      What a helpful person cheesefood is.......prat!!! Ifv your thumbnails were saved in an earlier version of PS they may not open so you will need to...
    2. Illustrator thumbnails Win YES and illustrator thumbnails Mac NO? thumbnails thumbnails Illustr
      Y have 2 different version Adobe Creative Suite one for windows, and one for MacOS X. The probem is: and Illustrator CS Mac the illustrator file...
    3. thumbnails with php
      hy all, i am complety new to GD and i must have a code within 2 days that does the following for me - Upload an image (jpg / png / gif) and...
    4. [PHP] deleting one cookie is deleting both..why? (tiny scripts)
      --- Ryan A <ryan@jumac.com> wrote: If you are setting the cookie from bestwebhosters.com, the best way (my opinion) is to not specify the domain,...
    5. deleting one cookie is deleting both..why? (tiny scripts)
      Hi again, I am setting 2 cookies like so:(setCookie.php) <?php setcookie("name1","1","0","",".bestwebhosters.com");...
  3. #2

    Default Re: Help deleting thumbnails

    Did you response.write ImagePath2 and see what it contains?

    --
    [url]http://www.aspfaq.com/[/url]
    (Reverse address to reply.)






    "Me" <admin@nospamonlineukdating.co.uk> wrote in message
    news:%23ZUUz7vdEHA.3420@TK2MSFTNGP12.phx.gbl...
    > Hi Folks,
    >
    > I'm trying to delete 2 files using fso. The mail file name is stored in an
    > access db.
    > using the code below I can delete the main file but not the thumbnail.
    >
    > The thumbnail has the same file name plus the suffix "_small" so if the
    > main
    > file
    > is called "mypicture.jpg" the thumbnail is called "mypicture_small.jpg"
    >
    > The main file is being deleted but no matter how I try I cannot get the
    > thumbnail
    > deleted. They are both in the same folder with the same permissions.
    >
    > Can anyone shed any light on why this doesn't work?
    >
    >
    > Dan
    >
    >
    >
    > Dim Photo, PhotoSmall
    > Photo= Rs_photo.Fields.Item("Photo_name").Value
    > PhotoSmall = Left(Photo, Len(Photo)-4)
    > PhotoSmall = PhotoSmall & "_small" & Right(Photo,4)
    >
    > Set File = CreateObject("Scripting.FileSystemObject")
    > ImagePath = Server.MapPath("..\images\M_photos")
    > ImagePath2 = Server.MapPath("..\images\M_photos")
    > ImagePath = ImagePath & "\" & Photo
    > ImagePath2 = ImagePath & "\" & PhotoSmall
    >
    > ' check if file exists and if true delete the file
    > If fileExists(ImagePath) Then
    > File.DeleteFile(ImagePath)
    > End if
    > If fileExists(ImagePath2) Then
    > File.DeleteFile(ImagePath2)
    > End if
    >
    >

    Aaron [SQL Server MVP] Guest

  4. #3

    Default Re: Help deleting thumbnails

    Hi,

    No I didn't. I'm one of those lost souls that rely on Dreamweaver.
    Then hack around in the code to get thing working.

    In other words I don't really now what I'm doing.
    I shall attempt what you suggest and with that in mind
    I may see where I'm going wrong. Correct.

    I'll post again if I don't get any further.

    Thanks your help.

    Dan

    "Aaron [SQL Server MVP]" <ten.xoc@dnartreb.noraa> wrote in message
    news:#Asdt$vdEHA.3732@TK2MSFTNGP11.phx.gbl...
    > Did you response.write ImagePath2 and see what it contains?
    >
    > --
    > [url]http://www.aspfaq.com/[/url]
    > (Reverse address to reply.)
    >
    >
    >
    >
    >
    >
    > "Me" <admin@nospamonlineukdating.co.uk> wrote in message
    > news:%23ZUUz7vdEHA.3420@TK2MSFTNGP12.phx.gbl...
    > > Hi Folks,
    > >
    > > I'm trying to delete 2 files using fso. The mail file name is stored in
    an
    > > access db.
    > > using the code below I can delete the main file but not the thumbnail.
    > >
    > > The thumbnail has the same file name plus the suffix "_small" so if the
    > > main
    > > file
    > > is called "mypicture.jpg" the thumbnail is called "mypicture_small.jpg"
    > >
    > > The main file is being deleted but no matter how I try I cannot get the
    > > thumbnail
    > > deleted. They are both in the same folder with the same permissions.
    > >
    > > Can anyone shed any light on why this doesn't work?
    > >
    > >
    > > Dan
    > >
    > >
    > >
    > > Dim Photo, PhotoSmall
    > > Photo= Rs_photo.Fields.Item("Photo_name").Value
    > > PhotoSmall = Left(Photo, Len(Photo)-4)
    > > PhotoSmall = PhotoSmall & "_small" & Right(Photo,4)
    > >
    > > Set File = CreateObject("Scripting.FileSystemObject")
    > > ImagePath = Server.MapPath("..\images\M_photos")
    > > ImagePath2 = Server.MapPath("..\images\M_photos")
    > > ImagePath = ImagePath & "\" & Photo
    > > ImagePath2 = ImagePath & "\" & PhotoSmall
    > >
    > > ' check if file exists and if true delete the file
    > > If fileExists(ImagePath) Then
    > > File.DeleteFile(ImagePath)
    > > End if
    > > If fileExists(ImagePath2) Then
    > > File.DeleteFile(ImagePath2)
    > > End if
    > >
    > >
    >
    >

    Me Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139