Not via FTP, you can't. :)Quote:
Not neccessarily... you can modify files that are on the server through php, but it is hard to do so, depending on complexity.
Printable View
Not via FTP, you can't. :)Quote:
Not neccessarily... you can modify files that are on the server through php, but it is hard to do so, depending on complexity.
Someone tell me that with ftp continues upload a file to the end despite network problems and with http the upload breaks. Itīs true??
The question isn't completely right. I will reformulate:Quote:
One more question. Can I do an update query for change a file?
Can I do an update query via ftp?
I don´t understand why doesn't update the register knowing that with a insert query works:
PHP Code:if ($_POST["edit"] == "Alterar")
{
if ($_POST["titulo"] != "")
{
// set up basic connection
$conn_id = ftp_connect($ftp_server);
// login with username and password
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
// check connection
if ((!$conn_id) || (!$login_result)) {
//echo "FTP connection has failed!";
echo "<script>alert('Ligação ao servidor FTP falhada.');</script>";
//echo "Attempted to connect to $ftp_server for user $ftp_user_name";
exit;
} else {
//echo "Connected to $ftp_server, for user $ftp_user_name";
}
// upload the file
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
// check upload status
if (!$upload) {
$sql = "update livros set imagem = '', titulo = '".$_POST["titulo"]."', autor = '".$_POST["autor"]."', ano = '".$_POST["ano"]."', editora = '".$_POST["editora"]."', link = '".$_POST["link"]."', link_text = '".$_POST["link_text"]."', descricao = '".$_POST["descricao"]."', cat_ID = '".$_POST["cat_ID"]."' where livro_ID = ".$_POST["livro_ID"];
echo "<script>alert('Ficheiro actualizado com sucesso sem imagem.');</script>";
} else {
if (is_file("../images/livros/".$_FILES['file']['name'])) {
$sql = "update livros set imagem = 'images/livros/".$_FILES["file"]["name"]."', titulo = '".$_POST["titulo"]."', autor = '".$_POST["autor"]."', ano = '".$_POST["ano"]."', editora = '".$_POST["editora"]."', link = '".$_POST["link"]."', link_text = '".$_POST["link_text"]."', descricao = '".$_POST["descricao"]."', cat_ID = '".$_POST["cat_ID"]."' where livro_ID = ".$_POST["livro_ID"];
//echo " Actual query: " .$sql;
echo "<script>alert('Ficheiro actualizado com sucesso.');</script>";
}
//echo "Uploaded $source_file to $ftp_server as $destination_file";
}
// close the FTP stream
ftp_close($conn_id);
}
else
{
echo "<script>alert('Título obrigatório.');</script>";
}
}
Can you explain??
NOTE: it confirms the updating but the register don´t modify!!