简体   繁体   中英

imagejpeg() directory writing error with PHP

I'm getting the following error when trying to save an image

Unable to open '/Applications/XAMPP/xamppfiles/htdocs/profile_images/' for writing:
Is a directory in /Applications/XAMPP/xamppfiles/htdocs/user.php on line 538

This is the line of code that's giving me trouble

imagejpeg($image, "/Applications/XAMPP/xamppfiles/htdocs/profile_images/".$userid);

I'm running XAMPP on a mac and mysql.

So far I've done the following:

  1. Opened the directory options and set everyone's access to read/write
  2. checked php.ini and made sure safe_mode was set to off
  3. chmod 777 to said folder

Any other suggestions?

Just in case I used chmod wrong, this is exactly what I typed

su root
chmod -R 777 /Applications/XAMPP/xamppfiles/htdocs/profile_images

imagejpeg needs a filename at second parameter

imagejpeg ( resource $image [, string $filename [, int $quality ]] )

You are pointing to a directory, not a filename

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM