Uploading Files

Discussion in 'PHP' started by gigamike, Jul 27, 2007.

  1. #1
    Guys,

    I saw a site wherein it allows 2 ways of upload. First one is the ordinary upload using <input type="file" name="file" />. The other one is using a <input type="text" name="textfield" /> and the user will enter a URL i.e. www.mydomain.com/myvideo.avi.

    Any ideas on how can i do that using the URL.

    Thanks,

    Mike
     
    gigamike, Jul 27, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    nico_swd, Jul 27, 2007 IP
  3. norfstar

    norfstar Peon

    Messages:
    1,154
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Use the file_get_contents function to get desired file source into a string, then fopen, fwrite and fclose to write it to your server.

    If its installed, an alternative to file_get_contents is to use the cURL library which gives you a few more advanced options.
     
    norfstar, Jul 27, 2007 IP
  4. Sygon

    Sygon Peon

    Messages:
    439
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Sygon, Jul 27, 2007 IP