1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Image Upload Script

Discussion in 'HTML, Graphics & Programming' started by Chronicle, 10 Jul 2006.

  1. Chronicle

    Mobster

    Joined: 4 Jul 2004

    Posts: 2,649

    Location: aberdeen

    Hello
    I want to make a site similar to imageshack.us, no sign up, just a browse input box, and submit, you click submit and you get the code. However I want to write it myself, any good tutorials about this?

    I've found some, but none deal with making sure it is under xMB, or is a gif/png/jpg etc

    Thanks
     
  2. Conrad11

    Soldato

    Joined: 12 Jun 2005

    Posts: 5,362

    I have created one, from a load of tutorials, cannot remember them all.

    I am also very new to php and am very poor with markup efficiency, so there may be a better was of doing it.

    That in mind, you are welcome to have a look at it, and includes the things to make sure it's under a certain size and makes it so you can only upload images.

    Here is what I used to correct certain security flaws in the PHP: Roblog Secuirty Guide

    Click Here for script - uploaded using Beansprouts Uploader

    Hope this helps!







    EDIT:

    Link to php script updated
     
    Last edited: 11 Jul 2006
  3. Chronicle

    Mobster

    Joined: 4 Jul 2004

    Posts: 2,649

    Location: aberdeen

    Cheers, i'll take a look at that :)
     
  4. Beansprout

    Man of Honour

    Joined: 31 Jan 2004

    Posts: 16,325

    Location: Plymouth

    I looked at the first 3 lines of that script and I'd change the config varialbes to constants:

    Code:
     $config['script']['localpath'] = "/local/path/to/uploads/";
        $config['script']['webpath'] = "http://www.yourdomain.com/uploads/"; 
    
    To:
    Code:
    define('LOCAL_PATH', '/local/path/to/uploads/');
    define('WEB_PATH', 'http://www.yourdomain.com/uploads/'); 
    
    <<< This is what I do when I'm bored. Point out handy little PHP features which don't really have any useful impact to the user :)