Announcement

Collapse
No announcement yet.

Content type in uploads

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Content type in uploads



    I am trying to determine how an upload form tells what type of file it is (gif, pdf, etc).

    I can find the extension, but does this hold true for a file uploaded from a mac?

    Is there some other way?
    The Miva_ValidateFileUpload function returns a whole string of strange stuff... Is this documented
    anywhere?

    Bill



    #2
    Content type in uploads



    Bill,
    There's a variable assigned in both functions:

    <MvFUNCTION NAME="Miva_ValidateFileUpload"
    PARAMETERS="field,filename,content_type">

    and

    <MvFUNCTION NAME="Miva_ProcessFileUpload"
    PARAMETERS="field,filename,status,tempfile,content _type,size">

    but I remember some discussion from some time ago that it doesn't always
    work (or rather, report it) correctly. Personally, I've never had any luck
    with it. Maybe it's fixed now.

    Bill M.

    > -----Original Message-----
    > From: [email protected]
    > [mailto:[email protected]] On Behalf Of Bill Gilligan
    > Sent: Friday, April 22, 2005 3:45 PM
    > To: [email protected]
    > Subject: [meu] Content type in uploads
    >
    >
    > I am trying to determine how an upload form tells what type
    > of file it is (gif, pdf, etc).
    >
    > I can find the extension, but does this hold true for a file
    > uploaded from a mac?
    >
    > Is there some other way?
    > The Miva_ValidateFileUpload function returns a whole string
    > of strange stuff... Is this documented anywhere?
    >
    > Bill
    >
    >

    Comment


      #3
      Content type in uploads



      On Fri, 22 Apr 2005 17:55:30 -0500, Bill Matlock <[email protected]>
      gave utterance to the following:

      > Bill,
      > There's a variable assigned in both functions:
      >
      > <MvFUNCTION NAME="Miva_ValidateFileUpload"
      > PARAMETERS="field,filename,content_type">
      >
      > and
      >
      > <MvFUNCTION NAME="Miva_ProcessFileUpload"
      > PARAMETERS="field,filename,status,tempfile,content _type,size">
      >
      > but I remember some discussion from some time ago that it doesn't always
      > work (or rather, report it) correctly. Personally, I've never had any
      > luck
      > with it. Maybe it's fixed now.
      >
      From my experiments, it works so long as the server is Apache 1.3.6 or
      later (including 2.x) (no idea about other flavours of server).
      Unless specifically configured, Apache makes all its assumptions about
      MIME type based on extensions anyway. My upload scripts allow the user to
      specify filename on server, with a reminder to Mac users to add an
      extension. I've seen binaries corrupted when not given an extension.
      I'm working on a guide to uploads to go on mivascript.org

      --
      Richard Grevers
      Between two evils always pick the one you haven't tried



      Comment


        #4
        Content type in uploads



        That content type variable doesn't work as expected all the time for
        some reason, so I've resorted to parsing the filename out of whatever
        the l.filename variable is and then checking what the extension is for
        validity.

        Bill Matlock wrote:
        > Bill,
        > There's a variable assigned in both functions:
        >
        > <MvFUNCTION NAME="Miva_ValidateFileUpload"
        > PARAMETERS="field,filename,content_type">
        >
        > and
        >
        > <MvFUNCTION NAME="Miva_ProcessFileUpload"
        > PARAMETERS="field,filename,status,tempfile,content _type,size">
        >
        > but I remember some discussion from some time ago that it doesn't always
        > work (or rather, report it) correctly. Personally, I've never had any luck
        > with it. Maybe it's fixed now.
        >
        > Bill M.
        >
        >
        >>-----Original Message-----
        >>From: [email protected]
        >>[mailto:[email protected]] On Behalf Of Bill Gilligan
        >>Sent: Friday, April 22, 2005 3:45 PM
        >>To: [email protected]
        >>Subject: [meu] Content type in uploads
        >>
        >>
        >>I am trying to determine how an upload form tells what type
        >>of file it is (gif, pdf, etc).
        >>
        >>I can find the extension, but does this hold true for a file
        >>uploaded from a mac?
        >>
        >>Is there some other way?
        >>The Miva_ValidateFileUpload function returns a whole string
        >>of strange stuff... Is this documented anywhere?
        >>
        >>Bill
        >>
        >>

        Comment


          #5
          Content type in uploads



          As I said in the email:
          The Miva_ValidateFileUpload function returns a whole string of strange stuff... Is this documented
          anywhere?

          Bill

          =============================
          Bill Gilligan
          Gilligan On-Line
          www.gilliganonline.com
          850-233-8775

          > -----Original Message-----
          > From: [email protected]
          > [mailto:[email protected]] On Behalf Of Bill Matlock
          > Sent: Friday, April 22, 2005 5:56 PM
          > To: 'Bill Gilligan'; [email protected]
          > Subject: RE: [meu] Content type in uploads
          >
          > Bill,
          > There's a variable assigned in both functions:
          >
          > <MvFUNCTION NAME="Miva_ValidateFileUpload"
          > PARAMETERS="field,filename,content_type">
          >
          > and
          >
          > <MvFUNCTION NAME="Miva_ProcessFileUpload"
          > PARAMETERS="field,filename,status,tempfile,content _type,size">
          >
          > but I remember some discussion from some time ago that it
          > doesn't always
          > work (or rather, report it) correctly. Personally, I've never
          > had any luck
          > with it. Maybe it's fixed now.
          >
          > Bill M.
          >
          > > -----Original Message-----
          > > From: [email protected]
          > > [mailto:[email protected]] On Behalf Of Bill Gilligan
          > > Sent: Friday, April 22, 2005 3:45 PM
          > > To: [email protected]
          > > Subject: [meu] Content type in uploads
          > >
          > >
          > > I am trying to determine how an upload form tells what type
          > > of file it is (gif, pdf, etc).
          > >
          > > I can find the extension, but does this hold true for a file
          > > uploaded from a mac?
          > >
          > > Is there some other way?
          > > The Miva_ValidateFileUpload function returns a whole string
          > > of strange stuff... Is this documented anywhere?
          > >
          > > Bill
          > >
          > >

          Comment


            #6
            Content type in uploads



            Apache 2.x

            Type returned is simply a mesh of stuff - nothing discernable - unless it is documented somewhere.

            Bill


            =============================
            Bill Gilligan
            Gilligan On-Line
            www.gilliganonline.com
            850-233-8775

            > -----Original Message-----
            > From: Richard Grevers [mailto:[email protected]]
            > Sent: Friday, April 22, 2005 6:17 PM
            > To: Bill Matlock; 'Bill Gilligan'; [email protected]
            > Subject: Re: [meu] Content type in uploads
            >
            > On Fri, 22 Apr 2005 17:55:30 -0500, Bill Matlock
            > <[email protected]>
            > gave utterance to the following:
            >
            > > Bill,
            > > There's a variable assigned in both functions:
            > >
            > > <MvFUNCTION NAME="Miva_ValidateFileUpload"
            > > PARAMETERS="field,filename,content_type">
            > >
            > > and
            > >
            > > <MvFUNCTION NAME="Miva_ProcessFileUpload"
            > > PARAMETERS="field,filename,status,tempfile,content _type,size">
            > >
            > > but I remember some discussion from some time ago that it
            > doesn't always
            > > work (or rather, report it) correctly. Personally, I've
            > never had any
            > > luck
            > > with it. Maybe it's fixed now.
            > >
            > From my experiments, it works so long as the server is
            > Apache 1.3.6 or
            > later (including 2.x) (no idea about other flavours of server).
            > Unless specifically configured, Apache makes all its
            > assumptions about
            > MIME type based on extensions anyway. My upload scripts allow
            > the user to
            > specify filename on server, with a reminder to Mac users to add an
            > extension. I've seen binaries corrupted when not given an extension.
            > I'm working on a guide to uploads to go on mivascript.org
            >
            > --
            > Richard Grevers
            > Between two evils always pick the one you haven't tried
            >
            >


            Comment


              #7
              Content type in uploads



              That's what I was afraid of.

              Bill

              =============================
              Bill Gilligan
              Gilligan On-Line
              www.gilliganonline.com
              850-233-8775

              > -----Original Message-----
              > From: [email protected]
              > [mailto:[email protected]] On Behalf Of Scot Ranney
              > Sent: Friday, April 22, 2005 6:26 PM
              > To: Bill Matlock
              > Cc: 'Bill Gilligan'; [email protected]
              > Subject: Re: [meu] Content type in uploads
              >
              > That content type variable doesn't work as expected all the time for
              > some reason, so I've resorted to parsing the filename out of whatever
              > the l.filename variable is and then checking what the
              > extension is for
              > validity.
              >
              > Bill Matlock wrote:
              > > Bill,
              > > There's a variable assigned in both functions:
              > >
              > > <MvFUNCTION NAME="Miva_ValidateFileUpload"
              > > PARAMETERS="field,filename,content_type">
              > >
              > > and
              > >
              > > <MvFUNCTION NAME="Miva_ProcessFileUpload"
              > > PARAMETERS="field,filename,status,tempfile,content _type,size">
              > >
              > > but I remember some discussion from some time ago that it
              > doesn't always
              > > work (or rather, report it) correctly. Personally, I've
              > never had any luck
              > > with it. Maybe it's fixed now.
              > >
              > > Bill M.
              > >
              > >
              > >>-----Original Message-----
              > >>From: [email protected]
              > >>[mailto:[email protected]] On Behalf Of Bill Gilligan
              > >>Sent: Friday, April 22, 2005 3:45 PM
              > >>To: [email protected]
              > >>Subject: [meu] Content type in uploads
              > >>
              > >>
              > >>I am trying to determine how an upload form tells what type
              > >>of file it is (gif, pdf, etc).
              > >>
              > >>I can find the extension, but does this hold true for a file
              > >>uploaded from a mac?
              > >>
              > >>Is there some other way?
              > >>The Miva_ValidateFileUpload function returns a whole string
              > >>of strange stuff... Is this documented anywhere?
              > >>
              > >>Bill
              > >>
              > >>

              Comment


                #8
                Content type in uploads



                On Fri, 22 Apr 2005 19:43:32 -0500, Bill Gilligan
                <[email protected]> gave utterance to the following:

                > Apache 2.x
                >
                > Type returned is simply a mesh of stuff - nothing discernable - unless
                > it is documented somewhere.
                >
                Maybe its broken in Miva 4? I was getting valid MIME types when I
                evaluated the variable in 3.97
                --
                Richard Grevers
                Between two evils always pick the one you haven't tried



                Comment

                Working...
                X