Upload question

How would I create an upload system so I can upload images to my site, and the images be stored into a directory named gallery?

My form is simple:

[code]
File:

[/code]

I already found a tutorial to show the images on the site, but I want to make an upload thing so certain people can upload images to that directory.

[php] <?php
$dir = “gallery/”;
// Open Directory.
if($opendir = opendir($dir)) {
//Read Directory.
while (($file = readdir($opendir)) !== FALSE) {
//Check to see if it’s an actual image.
if($file!="." && $file!="…") {
//Show the images.
echo “”;
}
}
}
?>[/php]

There is no edit, so I’m replying.

Okay so I’ve tried to create an upload script. It’s echoing out “image Uploaded”, but no such file is being uploaded…

[php]<?php
if(isset($_POST[“submit”])){
$to = “…/gallery/”;
move_uploaded_file($_FILES[‘image’][‘name’], $to);
echo “Image Uploaded”;
}
else
{
echo ’
File:

'; } ?>[/php]

Hi there,

I’ll check my facts when I get round to it, but I think you need to use:
[php]move_uploaded_file($_FILES[‘image’][‘tmp_name’], $to);[/php]

That didn’t work, the same thing happens, the image doesn’t get added to the gallery directory.

Sponsor our Newsletter | Privacy Policy | Terms of Service