PHP file upload system, need help customizing it
Posted: Tue Feb 26, 2008 12:46 pm
I am fairly new to PHP scripting and have come across a little problem. I am creating a file upload system so users can upload there owns photo's. I have got the following script but i need help in customizing it to fit my needs
uploader.php
generate.php
photos.php (where the user sees the uploaded photo)
I need help to define how the image will look. I need to know how i can get the php code to add a CSS style to the photo and if possible for it to use the lightbox javascript action. The lightbox isn't exactly essential as long as i can link to a full size image but it would be nice. Also the CSS script would shrink the photo for the thumbnail. I just need to link to a full size image.
I hope that you can understand this and that you can help me out cos it is really getting on my nerves now. I have tried everything i can think of
Thanks
uploader.php
Code: Select all
<?php
// Where the file is going to be placed
$target_path = "uploads/";
/* Add the original filename to our target path.
Result is "uploads/filename.extension" */
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$_FILES['uploadedfile']['tmp_name'];
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
require_once('generate.php');
} else{
echo "There was an error uploading the file, please try again!";
}
?>
<br /><br />
<a href="photogallery.php">Click Here to View Your Photo</a>Code: Select all
<?php
$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);
$pfile = fopen("userpics.htm","a+");
// If everything is OK -> store user data
fwrite($pfile, "\n<embed src = \"$target_path\" /><p>");
fclose($pfile);
?>Code: Select all
<?php
include("userpics.htm");
?>I hope that you can understand this and that you can help me out cos it is really getting on my nerves now. I have tried everything i can think of
Thanks