Hi all,
Can anyone see where i am going wrong?
I'm testing an upload facility.
Here's the code for displaying the upload form:
<?
$UPLOAD_NUM = 1;
function displayUploadForm ()
{
global $UPLOAD_NUM;
$displayed = '';
for ($i = 0; $i < $UPLOAD_NUM; $i++)
{
$displayed .= "<input type=file name=File$i length=40>";
}
print $displayed;
}
displayUploadForm ();
?>
and here is the code to upload:
include("include/dbconnect.php");
$UPLOAD_PATH = "C:/phpdev/www/SWIFTFLIX sell/cover_images/";
$UPLOAD_NUM = 1;
global $UPLOAD_PATH,
$UPLOAD_NUM,
$HTTP_POST_FILES;
$buff = '';
$error = 0;
for ($i = 0; $i < $UPLOAD_NUM; $i++)
{
$name = $HTTP_POST_FILES["File$i"]['name'];
$tmp = $HTTP_POST_FILES["File$i"]['tmp_name'];
if (!is_uploaded_file ($tmp))
continue;
$buff .= "$name";
if (!@move_uploaded_file($tmp, $UPLOAD_PATH."/".$name))
$error = 1;
}
$sql_query ="INSERT INTO movie (movie_title, movie_current_price, movie_cover_small)
VALUES ('$movie_title','$movie_current_price','$buff')";
$result = mysql_query($sql_query);
//etc. etc. etc.
At the moment it is inserting the data from the other fields on the form but not the "movie_cover_small".
Any ideas to why this might be. Is my
$UPLOAD_PATH = "C:/phpdev/www/SWIFTFLIX sell/cover_images/";
correct for a Windows machine?
Cheers,
micmac