Image Upload Script?

Discussion in 'Computer Programming, Emulation, and Game Modding' started by Twiffles, Aug 30, 2009.

Aug 30, 2009

Image Upload Script? by Twiffles at 7:33 AM (741 Views / 0 Likes) 1 replies

  1. Twiffles
    OP

    Member Twiffles танковые победы

    Joined:
    Sep 6, 2007
    Messages:
    1,925
    Country:
    Germany
    I've been trying to find/make a simple PHP script that'll upload a picture, rename it with a random short name, then display the direct URL if it is successful.
    So far, I got to the upload part. It'll upload the picture, but it'll keep the original file name and won't spit out a URL. Just a success message.

    Which leads to my question: Does anyone have/know where to find a script that can do such a task?

    Thanks :x

    EDIT: Well, I figured out how to rename the file after upload. Now I just need a way to show me the URL to the image. xD
     
  2. Cyan

    Global Moderator Cyan GBATemp's lurking knight

    Joined:
    Oct 27, 2002
    Messages:
    16,400
    Location:
    Engine room, learning
    Country:
    France
    I found this on php.net, if you use a form with method POST :

    CODEIt check if the uploaded file is correctly uploaded, and if it is, move it to the specified folder, so you could know the path to the file.

    http://fr2.php.net/manual/en/features.file...post-method.php
    http://fr2.php.net/manual/en/function.move-uploaded-file.php


    $_FILE is an array with all the data from all the uploaded files (if there were many picture at once for example).
    You can check the array in comment from 18 mars 2009 :
    http://fr2.php.net/manual/en/reserved.variables.files.php

    $_FILE[name of the 'type=file' input][$_FILE array name]
     

Share This Page