Hi,
After we let the user upload file to the server, how do we actually detect
if that is a valid jpeg file ?
thanks,
Tee 4 2284
Almost all standart files (such as jpg, gif, doc, ... ) have a header.
Look up jpeg file format and most likely the first 3 bytes will be preset to
something like (JPG).
George.
"THY" <th*@streamyx.com> wrote in message
news:el**************@TK2MSFTNGP10.phx.gbl... Hi,
After we let the user upload file to the server, how do we actually detect if that is a valid jpeg file ?
thanks, Tee
Anyone know how to do it ?
"George Ter-Saakov" <no****@hotmail.com> wrote in message
news:uk**************@TK2MSFTNGP10.phx.gbl... Almost all standart files (such as jpg, gif, doc, ... ) have a header. Look up jpeg file format and most likely the first 3 bytes will be preset
to something like (JPG).
George.
"THY" <th*@streamyx.com> wrote in message news:el**************@TK2MSFTNGP10.phx.gbl... Hi,
After we let the user upload file to the server, how do we actually
detect if that is a valid jpeg file ?
thanks, Tee
Do what?
I looked up the "jpeg header" in a google for you.
First 2 bytes have FFD8 in them.
So just read first 2 bytes and compare them to FFD8.
George.
"THY" <th*@streamyx.com> wrote in message
news:eS**************@TK2MSFTNGP10.phx.gbl... Anyone know how to do it ?
"George Ter-Saakov" <no****@hotmail.com> wrote in message news:uk**************@TK2MSFTNGP10.phx.gbl... Almost all standart files (such as jpg, gif, doc, ... ) have a header. Look up jpeg file format and most likely the first 3 bytes will be
preset to something like (JPG).
George.
"THY" <th*@streamyx.com> wrote in message news:el**************@TK2MSFTNGP10.phx.gbl... Hi,
After we let the user upload file to the server, how do we actually detect if that is a valid jpeg file ?
thanks, Tee
Why not check before upload?
Something like this:
If inpUploadPic.PostedFile.ContentType ="image/pjpeg" Then
'check file type to make sure is jpeg
If inpUploadPic.PostedFile.ContentLength < 52000 Then '
check file size < 50k or whatever you want
inpUploadPic.PostedFile.SaveAs(strUploadPath & "ad" &
intAdId & ".jpg")
where inpIploadPic is the name of your html file upload control.
THY wrote in message ... Anyone know how to do it ?
"George Ter-Saakov" <no****@hotmail.com> wrote in message news:uk**************@TK2MSFTNGP10.phx.gbl... Almost all standart files (such as jpg, gif, doc, ... ) have a header. Look up jpeg file format and most likely the first 3 bytes will be preset to something like (JPG).
George.
"THY" <th*@streamyx.com> wrote in message news:el**************@TK2MSFTNGP10.phx.gbl... > Hi, > > After we let the user upload file to the server, how do we actuallydetect > if that is a valid jpeg file ? > > thanks, > Tee > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Stephen Oakes |
last post by:
I am trying to upload an image to a server, but I get this warning:
Warning: imagecreatefromjpeg(): 'filename' is not a valid JPEG file
The error occurs when I am trying to create a thumbnail...
|
by: Chris Kennedy |
last post by:
Does anyone know a regular expression that will validate the file extension
but also allow multiple file extensions if necessary. It also needs to be
case insensitive. Basically, what I want is to...
|
by: Roy |
last post by:
Hi,
I have a problem that I have been working with for a while.
I need to be able from server side (asp.net) to detect that the file i'm
streaming down to the client is saved...
|
by: Baren |
last post by:
Hi!
I am using impersonate="true" to upload and download files from a network
share.
I have created common users on both the webserver and the file server. The
user has permission to the...
|
by: Jim Michaels |
last post by:
after a file upload, $_FILES is not populated but $_POST is. what's going
on here?
$_POST=C
$_POST=C
$_POST=C
$_POST=C:\\www\\jimm\\images\\bg1.jpg
$_FILES=
$_FILES=
$_FILES=
|
by: Jefferis NoSpamme |
last post by:
Hello all,
I'm trying to limit the file size to 1 meg on upload of image files and I am
trying a script from javascript internet, but it is giving me errors on IE
² is null or not an object ³...
|
by: matt |
last post by:
I have used some free code for listing files for download, but I want to
send an email to the administrator when the file has been downloaded. I
have got some code in here that does it, but it will...
|
by: =?iso-8859-1?B?QW5kcuk=?= |
last post by:
Other than installing PIL, is there a "simple" way using Python only
to determine if a file is a valid image file?
I'd be happy if I could at least identify valid images files for gif,
jpeg and...
|
by: premprakashbhati |
last post by:
hi, good evening..
i am going to upload an image in a web form .....for that iam using HTML input(file) control and one web control button i.e., Upload_Button()
here is the code ...its work fine...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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,...
|
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...
|
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...
| |