Hi Kenneth,
Once you put any supported image type into an Image or Bitmap object, it is
easily converted to any other supported format, by using the parameters of
the Save method of the Image class.
To prevent files other than JPEGs from being uploaded, use some JavaScript
validation on the client to check the value attribute of the File Upload
element in the form. It will be a string containing the full path of the
file to be uploaded Use Path.GetExtension() to get the extension, and if it
isn't "jpg" don't allow the form to submit.
--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.
"Kenneth Keeley" <ke*******@hotmail.com> wrote in message
news:ez**************@TK2MSFTNGP15.phx.gbl...
Hi,
I am creating a news and events page on my Intranet site and I wish to
allow people to upload an image with there news to my site. The text and
image are all stored in an SQL database. I have been successful in
uploading Jpeg files and downsampling them to a size that fits the web site. My next
challange is to convert other common file types (BMP, GIF, TIF) to jpegs
as well. Can this be done using the image object in ASP.net, if so could
somebody show me some sample code. Is it better if I just stop people from
uploading formats other than JPGs. If so can some body show me sample code
of how to stop the unwanted files from being uploaded.
Thanks
Kenneth