Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

MIME Types

Name: Anonymous 2006-05-10 5:52

How do you use MIME Types in PHP, i mean, i want to use this to recognize whether i'm reading excel file or csv file

Name: Anonymous 2006-05-10 7:10

>>1
Depends;
- You mean the server reading some data, right?
- Is it reading it from a file?

If the answer to both of these questions is true, as I understand your post, you want to use the mime_content_type function from extension mime_magic. Check this out: http://php.net/mime_magic

That's assuming the file doesn't have a proper filename. If it does, then Excel files should be .XLS and CSV files should be .CSV, just case-insensitively detect the extensions.


If you mean detecting from file uploads sent by the client, you can use either $_FILES[field_id]['name'] for the filename or $_FILES[field_id]['type'] for the MIME type of the file; however, know that the browser may not send one of them or either of them, so I'd rely on type first, then name, then error. Google a bit for a list of MIME types where you can see what's the type for extensions .xls and .csv . For more information, check the PHP manual, section "Handling file uploads" or something like that.

Name: Anonymous 2006-05-10 7:11

>>2
Come to think of it, I've written a serious, helpful answer in /prog (!)

Name: Anonymous 2006-05-10 7:19

>>3
lol, thanks XD

Name: Anonymous 2008-04-11 8:04

A
B
C

Name: Anonymous 2008-04-11 8:05

A\
B\
C\

Name: Anonymous 2008-04-11 8:05

A > B > C

Name: Anonymous 2008-04-11 8:06

A
B
C

Name: Anonymous 2008-04-11 8:07

A
B
C
> D
> > E

Name: Anonymous 2008-04-11 8:08

A
B
C
D
E

Name: Anonymous 2008-04-11 8:10

A
B
C
D
E

Name: Anonymous 2008-04-11 8:11

A
B
C
> > > > > D
> > E

Name: Anonymous 2008-04-11 8:13

A
B
C
D

Name: Anonymous 2008-04-11 8:14

A
B
C
D
E
F

Name: Anonymous 2008-04-11 8:46

















>


>




>
























[/o]

Name: Anonymous 2008-04-11 8:50

A
B
C
D
> E

Name: Anonymous 2008-04-11 8:50

A > > B > > > C

Name: Anonymous 2008-04-11 8:51

>>15
How do you do that?

Name: Anonymous 2008-04-11 9:00


>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
>

Testing this: > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]> > [br]> [br]>

Name: Anonymous 2008-04-11 9:01

orz i have failed

> > >

Name: Anonymous 2008-04-11 9:02

A
> B
> C
> D
> E

Name: Anonymous 2008-04-11 10:39

A> B

A
> B

Name: Anonymous 2008-04-11 10:42

A
> B

A
> B

A > B

orz

Name: Anonymous 2008-04-12 0:35

PHP is full of meme types and doesn't afraid of anything.

Name: Anonymous 2008-04-12 10:50


>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
> >
>
>

Name: Anonymous 2010-12-06 9:53

Back to /b/, ``GNAA Faggot''

Name: Sgt.Kabu쾿蜜kiman充⚹ 2012-05-28 19:07

Bringing /prog/ back to its people
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy
All work and no play makes Jack a dull boy

Don't change these.
Name: Email:
Entire Thread Thread List