I have a splash page that has banners on it and I want my members to be able to upload theyre banner to the page and placed at the bottom of the banners in the list.
Here is an example of what I have so far:
This is in my index.php file.
[code]
Filename:
This is in my upload_file.php file.
[php]<?php
$allowedExts = array(“gif”, “jpeg”, “jpg”, “png”);
$extension = end(explode(".", $_FILES[“file”][“name”]));
if ((($_FILES[“file”][“type”] == “image/gif”)
|| ($_FILES[“file”][“type”] == “image/jpeg”)
|| ($_FILES[“file”][“type”] == “image/jpg”)
|| ($_FILES[“file”][“type”] == “image/pjpeg”)
|| ($_FILES[“file”][“type”] == “image/x-png”)
|| ($_FILES[“file”][“type”] == “image/png”))
&& ($_FILES[“file”][“size”] < 200000)
&& in_array($extension, $allowedExts))
{
if ($_FILES[“file”][“error”] > 0)
{
echo "Return Code: " . $_FILES[“file”][“error”] . “
”;
}
else
{
echo "Upload: " . $_FILES[“file”][“name”] . “
”;
echo "Type: " . $_FILES[“file”][“type”] . “
”;
echo “Size: " . ($_FILES[“file”][“size”] / 200000) . " kB
”;
echo "Temp file: " . $_FILES[“file”][“tmp_name”] . “
”;
if (file_exists("upload/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
}
}
}
else
{
echo “Invalid file”;
}
?> [/php]
I put it together and tried to upload a banner. I clicked on choose file and it opened a window to choose a file. Then I clicked submit and the page said that the banner was uploaded but I did not see it in the upload_file folder. And I cant figure out how to get it to add the banner to the page!
Any help would be GRRRREATLY APPRECIATED!
Thank You for your time,
Daniel M. :-[