473,406 Members | 2,698 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

TIF = wrong ContentType on upload?

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
Nov 18 '05 #1
3 2065
> 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
Nov 18 '05 #2
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)
"darrel" <no*****@hotmail.com> wrote in message
news:eh****************@TK2MSFTNGP09.phx.gbl...
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

Nov 18 '05 #3
> 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
Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Bartosz Wegrzyn | last post by:
I am trying to upload images using either exec command. The file is uploaded ok. My script: <html> <head> <title>Picture Upload Page</title> <?php if ($_POST=="upload") {
1
by: John | last post by:
I can get this to upload files but I can't get items out of the Files collection into the database. I'm getting this error Microsoft VBScript runtime error '800a005b' Object variable not set...
3
by: Brian Birtle | last post by:
**** A CHALLENGE TO THE GURUS - refute the statement "It's impossible to build a file upload progress meter using ASP.NET" **** First person to prove me wrong gets "All Time .NET Programming GOD"...
6
by: John Boghossian | last post by:
Does anyone know what really happens when you call the method contenttype on the object httpPostedFile that returns the mime-type for the uploaded file. Is it so that the post request includes...
4
by: Alex Vincent | last post by:
HI all, I'm storing images, jpgs/gifs/png/bmps and also some other binary files in a SQL image field in a SQL 2k database. Most of the images enter the database via a asp.net webform upload,...
2
by: CVerma | last post by:
I'm using an html input control (System.web.UI.HTMLControls.HTMLInputFile) to upload files such as msword, excel, jpg, and pdf. I have the encType property set in the form:...
6
by: Wayne Wengert | last post by:
I am getting the following error whe I run this upload process. Code is below - error points to the lblInfo.Text = "Failed uploading file" line? The upload runs fine and the file is properly...
7
by: darrel | last post by:
I'm creating a file upload tool, and want to allow only DOC, XLS, PDF, RTF or TXT files. I am using this to check: if (contentType = "application/msword") _ or (contentType = "application/rtf")...
2
by: CindyH | last post by:
Hi Trying to get this code to work for http xml post. I need the post to be xml (doc.outerxml) sent in single key name as stream. The following is the post code and code for receiving the request....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.