webref.eu Posted June 2, 2009 Share Posted June 2, 2009 Hi All I need a script that can simply upload one image that I pick from my local computer to a folder on my server. Where do I start? Many thanks Quote Link to comment Share on other sites More sharing options...
xcoderx Posted June 2, 2009 Share Posted June 2, 2009 Il code u a simple and secure upload pay me but. Quote Link to comment Share on other sites More sharing options...
BK87 Posted June 2, 2009 Share Posted June 2, 2009 search the forum first, this questions has been discussed a gazillion times, along with google you will find all your answers. Quote Link to comment Share on other sites More sharing options...
DarkSuperHero Posted June 2, 2009 Share Posted June 2, 2009 PHP.net gives you the script! http://us3.php.net/manual/en/features.file-upload.php Quote Link to comment Share on other sites More sharing options...
zer0day Posted June 2, 2009 Share Posted June 2, 2009 Here's a very simple, "barebone" script to get the job done. Although it shouldn't be used as-is, it's at least a place for you to start. <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Simple Upload Script</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> </head> <body> <?php if(isset($_POST['submit'])) { $dir = "upload/"; // this directory needs to exist and permissions need to be 0777 $imagename = basename($_FILES['image']['name']); $newimage = $dir.$imagename; move_uploaded_file($_FILES['image']['tmp_name'], $newimage); } ?> <form method="POST" enctype="multipart/form-data" action=""> <input type="file" name="image" /><br /> <input type="submit" name="submit" value="UPLOAD IMAGE" /> </form> </body> </html> Hope this helps! Quote Link to comment Share on other sites More sharing options...
xcoderx Posted June 2, 2009 Share Posted June 2, 2009 The above codes r nt secured be careful or add some blacklists to stop hackers to upload stufs that wud destroy everythin u got. Quote Link to comment Share on other sites More sharing options...
zer0day Posted June 2, 2009 Share Posted June 2, 2009 The above codes r nt secured be careful or add some blacklists to stop hackers to upload stufs that wud destroy everythin u got. Right, which is why I said that it is a place for him to start, and shouldn't be used as-is. Quote Link to comment Share on other sites More sharing options...
xcoderx Posted June 2, 2009 Share Posted June 2, 2009 Oh yes and i meant no harm i was just leting him know coz u never know he may use it for public too. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.