Uploading files without using $_FILES

Discussion in 'PHP' started by gtk29, Sep 26, 2010.

  1. #1
    Hi,

    A web developer told me that there are other ways to upload a file in PHP, other than using the $_FILES array. I am puzzled. Is there any way to upload files without using $_FILES array in PHP?

    Thank you.
     
    gtk29, Sep 26, 2010 IP
  2. Media Signal

    Media Signal Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Never heard of an alternative to $_FILES.
     
    Media Signal, Sep 26, 2010 IP
  3. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #3
    Was that 'web developer' imaginery?
     
    danx10, Sep 26, 2010 IP
  4. gtk29

    gtk29 Member

    Messages:
    519
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #4
    LoL No. He is on another forum. I have asked him the details but no answer yet. So I guess, there are no alternatives within PHP, as I suspected.
    Thanks all for answers.
     
    gtk29, Sep 26, 2010 IP
  5. xrvel

    xrvel Notable Member

    Messages:
    918
    Likes Received:
    30
    Best Answers:
    2
    Trophy Points:
    225
    #5
    Well, you can use $HTTP_FILES_VARS instead of $_FILES.
    Lol, just kidding. I don't know how to upload file without $_FILES.
     
    xrvel, Sep 26, 2010 IP
  6. osol

    osol Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    If you want to upload from a form with http post there is no other way.You can use php ftp functions for uploading if you have access to the file location and location to upload.
     
    osol, Sep 26, 2010 IP
  7. gtk29

    gtk29 Member

    Messages:
    519
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    28
    #7
    Okay, the person (web developer) has confirmed that he was confused. Thanks for answering all :)

    Nice workaround there xrvel and osol :) Thanks
     
    gtk29, Sep 27, 2010 IP
  8. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #8
    $HTTP_FILES_VARS is a deprecated superglobal which is the equivalent of $_FILES for older PHP versions, so if your using the latest PHP you'd be using $_FILES and using $HTTP_FILES_VARS would trigger an error.

    Furthermore using the ftp_* functions will still require you to use the $_FILES array as you'll need to retrieve the uploaded file for it to be transfered to the ftp.
     
    danx10, Sep 27, 2010 IP
  9. xrvel

    xrvel Notable Member

    Messages:
    918
    Likes Received:
    30
    Best Answers:
    2
    Trophy Points:
    225
    #9
    Yeah, i second that, never use $HTTP_FILES_VARS on new PHP version ;)
     
    xrvel, Sep 27, 2010 IP