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 Link to comment https://forums.phpfreaks.com/topic/160635-need-a-simple-image-upload-script/ 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. Link to comment https://forums.phpfreaks.com/topic/160635-need-a-simple-image-upload-script/#findComment-847707 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. Link to comment https://forums.phpfreaks.com/topic/160635-need-a-simple-image-upload-script/#findComment-847716 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 Link to comment https://forums.phpfreaks.com/topic/160635-need-a-simple-image-upload-script/#findComment-847732 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! Link to comment https://forums.phpfreaks.com/topic/160635-need-a-simple-image-upload-script/#findComment-847738 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. Link to comment https://forums.phpfreaks.com/topic/160635-need-a-simple-image-upload-script/#findComment-847743 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. Link to comment https://forums.phpfreaks.com/topic/160635-need-a-simple-image-upload-script/#findComment-847747 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. Link to comment https://forums.phpfreaks.com/topic/160635-need-a-simple-image-upload-script/#findComment-847753 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.