Announcement

Collapse
No announcement yet.

content_types configured on the server?

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

    content_types configured on the server?

    Is there a way to determine what content_types are configured on the server?
    Last edited by RayYates; 04-24-18, 05:40 AM.
    Ray Yates
    "If I have seen further, it is by standing on the shoulders of giants."
    --- Sir Isaac Newton

    #2
    You can open a ticket for the site in question and request a copy of the /etc/mime.types file, however, you're far better off just setting the specific content type you want rather than relying on the operating system vendor to have a particular type pre-defined, since there's no guarantees future iterations of that file will have the same content type.
    David Hubbard
    CIO
    Miva
    [email protected]
    http://www.miva.com

    Comment


      #3
      Thanks

      I should have asked, more specifically, when server gets an uploaded file, it calls Miva_ValidateFileUpload() and Miva_ProcessFileUpload().

      Both of these function contain a content_type parameter, as explained here. http://www.mivascript.com/topic/file-uploading.html. It says,

      This function will be called automatically by Empresa (you do not need an explicit call to this function). It will be called with three arguments, The Empresa variable (field name) containing the filename, the filename value itself, and the MIME type (content_type) of the file on the uploading server.
      How is the content_type (passed to these functions) determined?
      Ray Yates
      "If I have seen further, it is by standing on the shoulders of giants."
      --- Sir Isaac Newton

      Comment


        #4
        When the Content-Type header is "multipart/form-data" the engine parses the headers and looks for any files that are being sent to it. When it finds a file it parses that content boundary which could (or should?) contain a "content-type" header.

        Here is an example of a test file I uploaded and looked at the sent headers via the network tools. You'll see the content-type header is present for the file and that is the value that is passed to the Validate / Process functions. I'm assuming the browser determines the content-type when it builds the multipart/form-data headers, but I'm not 100% on that.

        Code:
        ------WebKitFormBoundaryP6TpGiTpjBWJKqwO
        Content-Disposition: form-data; name="FileUpload_File"; filename="my_picture.jpg"
        Content-Type: image/jpeg
        David Carver
        Miva, Inc. | Software Developer

        Comment


          #5
          Ohhhhh I see! The content_type is NOT determined by the server but by the browser uploading the file.

          Thanks, that makes sense.
          Ray Yates
          "If I have seen further, it is by standing on the shoulders of giants."
          --- Sir Isaac Newton

          Comment

          Working...
          X