hi guys.. 1st of all i created this new thread because my old post wasnt presise enough + i have made changes
here is the error msg i get ..
Warning: Unable to create '/usr/pic/6584/sitamitop_01_1.gif': No such file or directory in /var/www/html/uppic.php on line 14
Warning: Unable to move '/var/www/temp/php4HbbKm' to '/usr/pic/6584/sitamitop_01_1.gif' in /var/www/html/uppic.php on line 14
Unknown table 'top_01_1' in field list
EDIT :: the files are not getting uploaded to the temp dir even though the permissions are correct & it exists
the code below is the new code..
i need to get this working fairly urgently now.. thanks in advance
Chris
here is the error msg i get ..
Warning: Unable to create '/usr/pic/6584/sitamitop_01_1.gif': No such file or directory in /var/www/html/uppic.php on line 14
Warning: Unable to move '/var/www/temp/php4HbbKm' to '/usr/pic/6584/sitamitop_01_1.gif' in /var/www/html/uppic.php on line 14
Unknown table 'top_01_1' in field list
EDIT :: the files are not getting uploaded to the temp dir even though the permissions are correct & it exists
the code below is the new code..
PHP Code:
<?php
session_start();
$MM_RestrictGoTo = "index.php";
if (!(isset($_SESSION['MM_Username']))){
header("Location: ". $MM_restrictGoTo);
}
require_once('Connections/database.php');
$file_dir = "/usr/pic/6584"; // directory where you want file to be uploaded to
$imgusr = $_SESSION['MM_Username'];
foreach( $_FILES as $file_name => $file_array ) {
if (substr($file_array['type'], 0, 5)=="image") {
if ( is_uploaded_file( $file_array['tmp_name'] ) ) {
move_uploaded_file( $file_array['tmp_name'], "$file_dir/".$imgusr.$file_array['name']);
mysql_select_db($database_database, $database);
$query_imgupload = "INSERT INTO files (fid, username, file_name, file_type, file_size) VALUES ('', '$imgusr', {$file_array['name']}, {$file_array['type']}, {$file_array['size']})";
$imgupload = mysql_query($query_imgupload, $database) or die(mysql_error());
$row_imgupload = mysql_fetch_assoc($imgupload);
$totalRows_imgupload = mysql_num_rows($imgupload);
}
}
}
?>
PHP Code:
The form field
<form enctype="multipart/form-data" method="post">
<input type="hidden" name="MAX_FILE_SIZE" value="3000000">
<input name="fupload" type="file"><br>
<input type="submit" value="Send File">
</form>
Chris
Comment