If I try to upload an image... It shows me the root folder with the size but it shows me only a white square... Not the picture with the resolution...
upload.php
<?php require '../conx.php';
session_start();
if(isset($_SESSION["userID"])){
} else{
header('Location: ../login.php');
}
?>
<?php
$ftp_server = "ftp.xxxx.com";
$ftp_user_name = "xxxx@exemple.com";
$ftp_user_pass = "xxxxx";
$destination_file = "/public_html/lifestyle/imagini/" . $_FILES['file']['name'];
$source_file = $_FILES['file']['tmp_name'];
// set up basic connection
$conn_id = ftp_connect($ftp_server);
ftp_pasv($conn_id, true);
// 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 "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
if (ftp_put($conn_id, $destination_file, $source_file, FTP_ASCII)) {
echo "successfully uploaded $destination_file\n";
header('Location: administrator/admin_index_lifestyle.php');
} else {
echo "There was a problem while uploading $destination_file\n";
}
// close the FTP stream
ftp_close($conn_id);
?>
form
<form action="upload.php" enctype="multipart/form-data" method="post">
<input name="file" type="file" />
Upload foto in folderul lifestyle/imagini/ pentru ARTICOL
<input name="submit" type="submit" value="Upload File in lifestyle" />
</form>
If I try to see the picture using the absolute link, it shows me only a white square... not the image. If I use FtpZilla to upload the image it works... So there must be a problem in my form.