1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Upload file from http post

Discussion in 'PHP' started by cmc@savycat.com, Oct 8, 2004.

  1. #1
    I have a host that I have very little control that is sending an http post that contains images, and file information. I am able to view this information with the help of the getallheaders() function that contains the follwing array values: ("Basic cm9vdDpzYXZ5Y2F0X2Jvb3N0ZXI=", "attachment; filename=image02048.jpg", "12389", "image/jpeg", "shttpclient $Revision: 1.28 $", "a", "s").
    SEMrush
    I assume that the first value is the actual image, and the rest of the values are file parameters. My goal is to save the file to a specified directory. I have a good deal of experience uploading files via html form enctype='multipart/form-data' and writing these files to anywhere in the file system, but I have no experience with the getallheaders() function or what to do with the array except parse out the values.

    TIA - cmc
     
    cmc@savycat.com, Oct 8, 2004 IP
    SEMrush
  2. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,283
    Likes Received:
    2,599
    Best Answers:
    460
    Trophy Points:
    710
    Digital Goods:
    29
    #2
    digitalpoint, Oct 8, 2004 IP
  3. cmc@savycat.com

    cmc@savycat.com Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    this http post is NOT coming from a html form with enctype="multipart/form-data", so $_FILES autoglobal array does nothing for me. I also can not change the method for the post.
     
    cmc@savycat.com, Oct 8, 2004 IP
  4. digitalpoint

    digitalpoint Overlord of no one Staff

    Messages:
    38,283
    Likes Received:
    2,599
    Best Answers:
    460
    Trophy Points:
    710
    Digital Goods:
    29
    #4
    Hmmm... how is the file data being stored then? Are you able to actually access the data that makes up the file itself?
     
    digitalpoint, Oct 8, 2004 IP
  5. cmc@savycat.com

    cmc@savycat.com Peon

    Messages:
    5
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    getallheaders() returns an array with the following values:

    ("Basic cm9vdDpzYXZ5Y2F0X2Jvb3N0ZXI=", "attachment; filename=image02048.jpg", "12389", "image/jpeg", "shttpclient $Revision: 1.28 $", "a", "s").

    I think the first value is the actual file data and the other values are file information.

    The other successful implementations for handling these uploads make the use of ASP's Request.BinaryRead and Perl's read(STDIN,$buffer, $length);
     
    cmc@savycat.com, Oct 8, 2004 IP