SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot dcgamers's Avatar
    Join Date
    Dec 2005
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Different kind of upload script

    Has anyone ever seen or made a php script that you enter a url of an image, and it automaticly uploads it to a location on your server? It would save a ton of time for me.

  2. #2
    SitePoint Guru babyboy808's Avatar
    Join Date
    Nov 2004
    Location
    dublin
    Posts
    602
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, 1 second

  3. #3
    SitePoint Guru babyboy808's Avatar
    Join Date
    Nov 2004
    Location
    dublin
    Posts
    602
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh sorry I have a local script, not a url, Any help?

  4. #4
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I created something similar a while back for someone who needed to change four images regularly. You may be able to tweak it.

    Here are links to the files:
    replaceImg.php
    imageFunctions.php
    showImages.php
    blank.gif

    You'll have to rename the files with a .php extension when downloaded (I didn't want them active as I haven't checked how secure this method is). Then put all three files in the same directory and load replaceImg.php.

    showImages.php is included for completeness, but displays the images in a way that is no use to anyone but the intended client.


    Hope it helps,

    Andy
    From the English nation to a US location.

  5. #5
    SitePoint Zealot _theworks's Avatar
    Join Date
    Dec 2005
    Location
    New Zealand
    Posts
    165
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try somthing like
    PHP Code:
    <?
    $dest_folder 
    "/uploads";

    if (!
    $_POST['url'])
    {
        echo 
    '<form method="post">';
        echo 
    '  <input type="text" name="url" value="http://"/>';
        echo 
    '  <input type="submit" value="Get File"/>';
        echo 
    '</form>';
    } else {
        
        
    $file file_get_contents($POST['url']);
        
        
    file_put_contents($dest_folder.'/'.rand(0,100));
    }
     
    ?>

  6. #6
    SitePoint Zealot dcgamers's Avatar
    Join Date
    Dec 2005
    Posts
    129
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sory for the long reply but:
    Fatal error: Call to undefined function: file_put_contents() in admin/urlupload.php on line 18
    How do I define it?
    EDIT: Found out why, I have PHP Version 4.3.11 I need PHP Version 5 to use that function.
    Now how to upgrade it.............


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
  •