-1

What is the most effective way to upload pictures to a photo gallery? I am currently doing the excel CSV method, and just want to know if this is too time consuming and what is involved in coding a fairly complex upload form?

3
Contributors
5
Replies
6
Views
7 Years
Discussion Span
Last Post by bjeffries
0

Feel free to use mine:
I tried to take some of the extra code out and dumb it down a bit.

Hopefully I didn't miss something. Good luck.

// FORM TO UPLOAD FILE

<p><form enctype="multipart/form-data" action="upload.php" method="POST">
		    <input name="uploaded" type="file" /><BR /><BR />
		    <input type="submit" value="Upload" id="findFileButton" />
		    </form></p>



// PHP
<?php
// obviously.. the user id
$user = stripslashes($_POST["user"]);

// directory of where the file will be uploaded to
$dirname = "./userfiles/{$user}/";

//checks to see if $dirname exists
if (is_dir($dirname)) {    
echo "The directory {$user} exists";    
} else {
// if it doesn't it creates a new folder and inserts a blank index.php file to hide the directory
	mkdir("userfiles/{$user}", 0777);
fopen("{$dirname}index.php", "w");    
echo "The directory {$user} was successfully created.";    
} 

$target = $dirname;
$target = $target . basename( $_FILES['uploaded']['name']) ;
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
}
else {
echo "Sorry, there was a problem uploading your file.";
}

?>
0

Hey thanks a lot man. The only problem is I would have to still get that to connect to the database and update that at the same time as uploading the files to the server. I am not going to give up I will eventually make an upload form, although, for now I am just going to stick to my method until I get my site rolling. Once that is I will create the upload form. Thanks again though.

0

Hey thanks a lot man. The only problem is I would have to still get that to connect to the database and update that at the same time as uploading the files to the server. I am not going to give up I will eventually make an upload form, although, for now I am just going to stick to my method until I get my site rolling. Once that is I will create the upload form. Thanks again though.

All you'd have to do is add some extra code in there, so when the file is uploaded it adds info to your database. I don't really see the problem?

Edited by Encrypted: n/a

0

I have looked up the php manual when I get stumped on something but does the manual help you with SQL when it comes to retrieving or posting?

There really is not a problem with adding code to your file, I just dont know how involved i would have to get when it comes to uploading multiple photos and also being able to add tags to each photo.

Then I would have to make a small admin section that requires a password so no one can get to my upload file. Then also too, I would need to have a gallery upload file, which needs to be able to upload a thumbnail, title, description, tags, date, and photographer.

I will probably build a small admin section with upload files and management when I have some more time, as of right now I am extremely busy with other stuff.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.