It looks like you're new here. If you want to get involved, click one of these buttons!
<?php
if ($_REQUEST['hebron_id']) {
$authorID = $_REQUEST['hebron_id'];
}
if ($_REQUEST['hebron_id']) {
$albumID = $_REQUEST['albumID'];
}
$connect = mysql_connect('xxx', 'xxx', 'xxx');
$author = 1;
mysql_select_db('xxx', $connect);
$sql = "SELECT folder FROM albums WHERE id='".$albumID."'";
$result = mysql_query($sql);
$album = mysql_fetch_array($result);
$albumFolder = $album['folder'];
$uploaddir = "xxxx" . $albumFolder . "/";
$file_name = $_FILES['userfile'][ 'name' ];
$newFileName = time() . "-" . $file_name;
$source_file_path = $_FILES['userfile']['tmp_name'];
if( move_uploaded_file( $source_file_path, $uploaddir.$newFileName ) ) {
$sql = "INSERT INTO images(file, album, author) VALUES('".$newFileName."', '".$albumID."', '".$author."')";
$result = mysql_query($sql);
if(!$result) {
echo "Could not store into database";
} else {
echo "Success!";
}
}
?>