[英]php imagejpeg(): Unable to open '/pic/upload/123.jpg' for writing: No such file or directory
幾天以來,我一直在尋找如何解決該問題的方法,並嘗試了所有在這里找到的方法。 我不是很擅長php,所以我希望這里的人比我更快地發現問題:)
許可在777上圖片被上傳到/ pic / tmp ...而且我還試圖更改為上傳到/ pic,多數民眾贊成在沒有任何問題的情況下.......僅當我想對imagejpeg()
感謝幫助!
(有些嘗試已經用// ...標記了,但是我嘗試的並不是全部)
<?php
$ftp_server = "adress";
$ftp_user_name = "user";
$ftp_user_pass = "password";
$destination_file = "/pic/upload/tmp/". basename($_FILES['file']['name']);
$uploaddir="/pic/upload/tmp/";
$newpath="/pic/upload/";
$ftppath="ftp://".$ftp_user_name.":".$ftp_user_pass."@".$ftp_server;
$source_file = $_FILES['file']['tmp_name'];
$conn_id = ftp_connect($ftp_server);
ftp_pasv($conn_id, true);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
$upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY);
$alterPfad=$ftppath.$uploaddir."123.jpg";
$neuerPfad=$newpath."123.jpg";
//$neuerPfad=$ftppath.$newpath."123.jpg";
//$neuerPfad=".".$newpath."123.jpg";
$bildEigenschaft = getimagesize($alterPfad);
$widthOld = $bildEigenschaft[0];
$heightOld = $bildEigenschaft[1];
$image_filetype = $bildEigenschaft[2];
$width=$widthOld;
$height=$heightOld;
if($width>670)
{list($width,$height)=Groessenberechnung($width,$height,670);
}
if($height>500)
{echo "<p>berechnung 2.1 weite:".$width." hoehe:".$height."</p>";
list($height,$width)=Groessenberechnung($height,$width,500);
}
$image_old = imagecreatefromjpeg($alterPfad);
$image_new = imagecreatetruecolor($width, $height);
imagecopyresampled($image_new, $image_old, 0, 0, 0, 0, $width, $height, $widthOld, $heightOld);
//tp_rename($conn_id,$destination_file,$uploaddir."123.jpg"); //ftp_put($conn_id,"/pic/upload/123.jpg","/pic/upload/tmp/123.jpg", FTP_BINARY);
//ftp_raw($conn_id,imagejpeg($image_new,$neuerPfad));
imagejpeg($image_new,$neuerPfad);
...
...
...
?>
我將echo
顯$neuerPfad
的值,以查看它嘗試打開的路徑。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.