Current location: Hot Scripts Forums » General Community » Script Requests » i need a simple PHP gallery


i need a simple PHP gallery

Reply
  #1 (permalink)  
Old 10-30-03, 01:11 AM
ports1980 ports1980 is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
i need a simple PHP gallery

i need a simple PHP image gallery for my users ......

i want a gallery that gallery not require any password any authenticaion and when somone uplaod the image it simpy store in a fiolder ......

like this


http://www.j4jumpy.net/upload/galler...r=user_uploads
Reply With Quote
  #2 (permalink)  
Old 10-30-03, 02:52 AM
Firestorm Firestorm is offline
Newbie Coder
 
Join Date: Oct 2003
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
well do you want the uploaded files to be displayed dynamicaly, i.e when new files are uploaded into this directory, you display the new files. If so you need three files, two php and one html.

This is the code for the uploading part

<?php
// In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of
// $_FILES. In PHP earlier then 4.0.3, use copy() and is_uploaded_file()
// instead of move_uploaded_file

$uploaddir = 'files/';
$uploadfile = $uploaddir. $_FILES['userfile']['name'];

print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
print "File is valid, and was successfully uploaded. ";
print "Here's some more debugging info:\n";
print_r($_FILES);
} else {
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
print "</pre>";

?>

This is for the upload form

<html>
<head>
<title>Test Upload </title>
</head>
<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
// the value I think is in bytes, but not sure
<input type="hidden" name="MAX_FILE_SIZE" value="30000">
Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>
</body>
</html>

and if you want to do the displaying dynamically look for a function called opendir on www.php.net

Hope this helps
Reply With Quote
  #3 (permalink)  
Old 10-30-03, 04:42 AM
Stefan's Avatar
Stefan Stefan is offline
Junior Code Guru
 
Join Date: Jun 2003
Location: Utrecht, The Netherlands
Posts: 599
Thanks: 0
Thanked 0 Times in 0 Posts
the above script is very insecure though, as one could easily upload php scripts to nuke the server.

it's a good start of course

a good and easy option is Gallery (http://gallery.menalto.com/) ... I've used it on a few occasions and it's easy and simple.
Reply With Quote
  #4 (permalink)  
Old 10-31-03, 12:42 PM
phrank phrank is offline
New Member
 
Join Date: Sep 2003
Location: NJ
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by ports1980
i need a simple PHP image gallery for my users ......

i want a gallery that gallery not require any password any authenticaion and when somone uplaod the image it simpy store in a fiolder ......

like this


http://www.j4jumpy.net/upload/galler...r=user_uploads
how about www.celerondude.com ----> click on PHP at the top
Reply With Quote
  #5 (permalink)  
Old 11-01-03, 12:07 AM
ports1980 ports1980 is offline
Newbie Coder
 
Join Date: Aug 2003
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Firestorm
well do you want the uploaded files to be displayed dynamicaly, i.e when new files are uploaded into this directory, you display the new files. If so you need three files, two php and one html.

This is the code for the uploading part

<?php
// In PHP earlier then 4.1.0, $HTTP_POST_FILES should be used instead of
// $_FILES. In PHP earlier then 4.0.3, use copy() and is_uploaded_file()
// instead of move_uploaded_file

$uploaddir = 'files/';
$uploadfile = $uploaddir. $_FILES['userfile']['name'];

print "<pre>";
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
print "File is valid, and was successfully uploaded. ";
print "Here's some more debugging info:\n";
print_r($_FILES);
} else {
print "Possible file upload attack! Here's some debugging info:\n";
print_r($_FILES);
}
print "</pre>";

?>

This is for the upload form

<html>
<head>
<title>Test Upload </title>
</head>
<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
// the value I think is in bytes, but not sure
<input type="hidden" name="MAX_FILE_SIZE" value="30000">
Send this file: <input name="userfile" type="file">
<input type="submit" value="Send File">
</form>
</body>
</html>

and if you want to do the displaying dynamically look for a function called opendir on www.php.net

Hope this helps



i m getting error while opening main page this error >>
Parse error: parse error in C:\apache\htdocs\up\index.php on line 7
Reply With Quote
  #6 (permalink)  
Old 11-02-03, 10:37 PM
MadDog MadDog is offline
Code Master
 
Join Date: Aug 2003
Posts: 935
Thanks: 0
Thanked 0 Times in 0 Posts
Topic moved to more appropriate forum.
__________________
Drew Gauderman
ASP - MSSQL Coder / Buisness Owner / Coder for Hire!
MSN-ICQ-AIM-YIM in Profile

http://www.iportalx.net an easy ASP portal system.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
simple photo gallery forcer Script Requests 5 01-08-04 09:07 AM
Free PHP / Flash photo gallery Niklas Script Requests 1 01-06-04 10:45 PM
Seeking for a simple photo gallery script... Sgrebs PHP 0 10-27-03 02:00 PM
php fuctinons simple tutorials part 1 Miguel222 PHP 0 10-18-03 02:03 AM
looking for a simple forum php code westwood Script Requests 5 10-07-03 02:26 AM


All times are GMT -5. The time now is 11:24 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.