TIF = wrong ContentType on upload?

D

darrel

I'm creating a tool for people to upload an image and have it resized on the
server. I'm checking to first see if the image is a JPG, GIF, BMP or TIF
file. I'm having a problem with the TIF files, on upload, the content type
is coming up as:

application/octet-stream

Instead of:

image/tif

Any reason why?

For now, if the content type comes up as app/octet-stream, then I'm going to
double-check the file extensions. If it's TIF, I'll go ahead and assume it
is one, but I'd love to figure out why it's wrong in the first place.

-Darrel
 
D

darrel

That content type you posted is not listed, so its probably something on
your end. You may want to post some code

It's not a code issue. It's how the TIF file is being seen by the server.

Here's what I was using:

if (contentType = "image/pjpeg") _
or (contentType = "image/jpeg") _
or (contentType = "image/gif") _
or (contentType = "image/bmp") _
or (contentType = "image/tif") _
then...go ahead and process image.

The problem is that, like I said, the tif files weren't being seen as
image/tif.
So, I added this OR to fix things:

or ((contentType = "application/octet-stream") and
(microsoft.VisualBasic.Right(strUploadFileName, 3) = "tif"))

but, that, of course, is a bit of a hack.

I'm only testing this on my machine, so perhaps it will return the correct
contentType for TIFs once I move the code to the staging server. However,
it's still odd that GIF and JPG show up correctly, but not TIF.

-Darrel
 
B

bruce barker

when a browser uploads a file it does not try to determine the mime-type, it
just upload the file as either text or binary (application/octet-stream)

-- bruce (sqlwork.com)
 
D

darrel

when a browser uploads a file it does not try to determine the mime-type,
it
just upload the file as either text or binary (application/octet-stream)

If that is the case, then why would JPG and GIF images be detected as
image/jpg and image/gif respectively?

The script I am using is inherited, so perhaps the detecting based on the
mime-time is moot, and I should only check for extensions?

-Darrel
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top