View Single Post
  #27 (permalink)  
Old March 10th, 2007, 11:05 AM
Imar's Avatar
Imar Imar is offline
Wrox Author
Points: 72,073, Level: 100
Points: 72,073, Level: 100 Points: 72,073, Level: 100 Points: 72,073, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,587 Times in 1,563 Posts

Since I don't know your code and only see the SaveToDatabase method, I can only guess. However, this looks weird:

If LenB(FileData) = 0 Or Right(FileData) <> .gif Then Exit Sub

What is FileData? Where does it get a value? I would assume it contains the actual file bytes, not the file name, right?

Again: I would take one step back if I were you. At the place where you get the file and call SaveToDisk or SaveToDatabase, look into the uploaded filename, and see if it ends with an extension you want to allow using VB Script's Mid, Left and Right functions.

There's no point in posting the same method over and over again. You'll need to look at the code that *calls* these methods to understand what contains the file name, and what contains the actual file.
Otherwise, I can only guess; which leads to nowhere...

Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.
Reply With Quote