Dedicated Upload page

I am new to php but know something about html and css. I was wondering if someone would be kind enough to help me out with a page dedicated to my website for uploading pictures. I do not need anything extravagant but something nice and simple with some security so no malicious files may be uploaded. Any help would be greatly appreciated. And yes I have searched google for this but it is above me at the moment

Well, you have asked for many things, believe it or not. First, uploading files. Next security. And, I assume you want to display the pictures which brings up a lot of code as you have to decide how many to show, if you want thumbnails, etc… Lots to cover…

So, first, Google is your friend, Google it your buddy! But, you must search with the correct keywords. If you are searching for PHP code, start the query with that. I used “php photo gallery tutorial” and the very first one
was a very thorough tutorial. After reading it quickly, I think it will do great for you. Once you create some code and test it, you can create a new post with your specific problems if any… Good luck!
http://www.sitepoint.com/php-gallery-system-minutes/

I have looked at that site you have told me about, very detailed and well written. I do have a question though, dreamweaver says there is something wrong with this code but I have no idea what it is, can you help me out with it?

also when I try to open it up i get this error “Parse error: syntax error, unexpected T_STRING in /hermes/bosweb26c/b2750/ipg.dahlkecomputerscom/upload/preupload.php on line 2”

[php]<?php
include ‘config.inc.php’;

// initialization
$photo_upload_fields = ‘’;
$counter = 1;

// If we want more fields, then use, preupload.php?number_of_fields=20
$number_of_fields = (isset($_GET[‘number_of_fields’])) ?
(int)($_GET[‘number_of_fields’]) : 5;

// Firstly Lets build the Category List
$result = mysql_query(‘SELECT category_id,category_name FROM gallery_category’);
while($row = mysql_fetch_array($result)) {
$photo_category_list .= <<<__HTML_END

$row[1]\n __HTML_END; } mysql_free_result( $result );

// Lets build the Image Uploading fields
while($counter <= $number_of_fields) {
$photo_upload_fields .= <<<__HTML_END

Photo {$counter}: Caption: __HTML_END; $counter++; }

// Final Output
echo <<<__HTML_END

Lets upload Photos $photo_upload_fields
Select Category $photo_category_list
__HTML_END; ?>[/php]

Well, it says it is line 2. If that file is the one you posted, it would be this line:

include 'config.inc.php';

So is the file config.inc.php in the same folder on the server as the one that call it? (the one you posted)

Also, these lines:
$photo_category_list .= <<<__HTML_END

$row[1]n __HTML_END;

is a bit odd. Normally it would be just something like:
$photo_category_list .= “$row[1]\n”;

That minor change means nothing in the processing, just prettier. Also, you could move the PHP up a few lines and remove the next version of the “html-end”… But, we can look at that later on after it is working…

Let me know if that file is in the same folder. If it is not, you will have to change the include to point to wherever it is. If it is in a folder, it would be something like the following…
include ‘some-folder-name/config.inc.php’;

Good luck… OH, PS: there are a lot of canned photo galleries out there. Some are fancy, some are easy, a lot are free. Even free file upload programs that are really impressive. But, I like doing it myself… A good programming puzzle is much fun!!! Let me know…

I do have that file in the same folder, and I tried to put the folder name in front but it did not help. Still stuck

Well, the error say it is in this line:
upload/preupload.php on line 2 (Is that the actual file you posted?)

So, the folder is “upload” and the included file: include ‘config.inc.php’;
must be inside that “upload” folder.

This error is quite often a spelling error. CAPS DO MATTER! Make sure there is no caps in the actual filename as there are none in the “config.inc.php”. So, check that out!

Also, there may be an error in the ‘config.inc.php’ which is being posted back to the ‘preupload.php’.
So, you may have to post both of these files. If you want, you can post them in a private message if there
is anything you do not want to post to the general public here.

I know I didn’t give you much help, but, hopefully we can sort it out…

Sponsor our Newsletter | Privacy Policy | Terms of Service