tengo un problema con este codigo....
es un sistema para subir imagenes a ftp con php
soy nuevo en esto... y me gustaria saber q tengo q hacer para q no me aparezca este error cuando cargan las imagenes, se cargan perfectamente, pero me aparece este error.
PHP Error Message
Warning: mysql_query() [function.mysql-query]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/a1682164/public_html/index.html on line 52
Free Web Hosting
PHP Error Message
Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/a1682164/public_html/index.html on line 52
Free Web Hosting
Imagen subida con exito! gracias.
este es el codigo q estoy usando
Código PHP:
<?php
//edit this
$_max_file_size = '3000000'; //file size in bytes.
$upload_dir = "somefolder/"; //upload folder..chmod to 777
$_i = "1"; //number of files to upload at one time
//end edit
echo "<table width=100% border=0 cellpadding=0 cellspacing=0>";
echo "<form enctype='multipart/form-data' action='?do=upload' method='post' style=\"margin: 0px;\">";
echo "<tr><td><input type='hidden' name='MAX_FILE_SIZE' value='" . $_max_file_size , "'></td></tr>";
if($_GET['do'] != 'upload')
{
echo "<tr><td class=redtext>Tamaño maximo foto 250px x 250px - Formatos .JPG o .GIF </td></tr>";
echo "<tr><td> </td></tr>";
echo "<tr><td class=bodytext>Elegi tu imagen:<br>";
//show number of files to select
For($i=0; $i <= $_i-1;$i++)
{
echo "<input name='file" . $i . "' type='file'></td></tr>";
}
echo "<tr><td class=bodytext><input type=submit name=Submit value=\"Upload Photo\" style=\"font-family: Verdana; font-size: 8pt; font-weight: bold; BACKGROUND-COLOR: #5E6456; COLOR: #ffffff;\"></td></tr>";
}
if($_GET['do'] == 'upload')
{
//upload all the fields until done
For($i=0; $i <= $_i-1; $i++)
{
//file with the upload folder
$target_path = $upload_dir . basename($_FILES['file' . $i]['name']);
$target_path = str_replace (" ", "", $target_path);
//actual file name with the random number
$_file_name = basename($_FILES['file' . $i]['name']);
$_file_name = str_replace (" ", "", $_file_name);
//do not upload the 'left blank' fields
if(basename($_FILES['file' . $i]['name']) != '')
{
if(move_uploaded_file($_FILES['file' . $i]['tmp_name'], $target_path))
{
//uploaded successfuly
$_uploaded=1;
}
else
{
//error uploading
$_error=1;
}
}
else
{
$_check=$_check+1;
}
}
//file(s) did upload
if($_uploaded == '1')
{
$_uploaded=0;
$adID = $_GET['adID'];
mysql_query("update tbl_whatever set photo = '".$_file_name."' WHERE whatever = '$whatever ");
}
//file uploaded?
if($_error == '1')
{
$_error=0;
echo "<div class=redtext>There was an error uploading some of the file(s), please try again! Maybe the file size is too large. Maximum file size is 3MB</div>";
}
//user selected a file?
if($_check == $_i)
{
$_check=0;
echo "<div class=redtext>Select a file first than click 'Upload File'</div>";
}
}
echo "</td>Imagen subida con exito! gracias.</tr>";
?>
</table>
desde ya... muchas gracias