SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist GeekSupport's Avatar
    Join Date
    May 2002
    Location
    Southern California
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    uploading .sql recognized as application/octet-stream

    when testing Zend's file upload script, i uploaded a file (sql.txt that was a sql backup) and $_FILES reported it as text/plain as it should. as soon as i renamed it to sql.sql, $_FILES now reports it as application/octet-stream. all i did was rename the file. to make matters worse, i thought Windows XPpro was adding some bits to the file to explain $_FILES new type so i renamed sql.sql to sql.exe; $_FILES now says it is text/plain, even with the .exe extention.

    does anyone know why adding the .sql extention would change the type from text/plain to application/octet-stream?

    btw, the webhost is a linux box (RH).

    more tested extentions (renaming sql.txt to the following extentions)
    .sql - application/octet-stream
    .php - application/octet-stream
    .gz - application/octet-stream
    .tar - application/octet-stream
    .htm - text/plain
    .html - text/plain
    .txt - text/plain
    .exe - text/plain
    .gif - text/plain
    .jpg - text/plain
    .asp - text/asp
    .rpm - audio/x-pn-realaudio-plugin
    .wav - audio/x-wav
    .mp3 - audio/mpeg

    (all i'm doing is changing the extention, nothing more. opening the file in notepad looks all ascii, no funky characters)

    [edit]
    now going the other way around
    real_picture.jpg -> real_picture.txt - image/pjpeg (as it should)
    Last edited by GeekSupport; Sep 14, 2003 at 21:40.

  2. #2
    SitePoint Evangelist GeekSupport's Avatar
    Join Date
    May 2002
    Location
    Southern California
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i found a better way to test the filetype (*nix only)

    http://216.239.33.104/search?q=cache...ng_en&ie=UTF-8

    PHP Code:
    $what exec('file '.$uploadfile);
    echo 
    $what

  3. #3
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The filetype in $_FILES is what is told to the server by the browser, I think IE sends everthing as application/octet-stream, unless it knows what it is, and I doubt it knows what an SQL file is.
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.

  4. #4
    SitePoint Evangelist GeekSupport's Avatar
    Join Date
    May 2002
    Location
    Southern California
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that's what i thought too, but my list also shows .exe/.jpg listed as text/plain

  5. #5
    "Of" != "Have" bronze trophy Jeff Lange's Avatar
    Join Date
    Jan 2003
    Location
    Calgary, Canada
    Posts
    2,063
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    that's strange...
    Who walks the stairs without a care
    It shoots so high in the sky.
    Bounce up and down just like a clown.
    Everyone knows its Slinky.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •