Tom
Tom

Reputation: 12998

php.ini - setting upload_tmp_dir

I have a page which allows users to upload photos - fairly standard php I think.

This works on the live server I've been using to date but I've recently set up php on my Mac and now the uploads have stopped working.

I'm guessing this is because the the upload_tmp_dir is not set properly in the php.ini file.

Does anyone know what I need to do?

EDIT:

Here's the error message that's output...

Warning: imagejpeg(): Unable to open 'upload/thumbs/AL.jpg' for writing: Permission denied in /Users/tom/Sites/tombrennand/add.php on line 128 Warning: imagejpeg(): Unable to open 'upload/images/AL.jpg' for writing: Permission denied in /Users/me/Sites/mysite/add.php on line 135 Notice: Undefined variable: con in /Users/me/Sites/mysite/add.php on line 172 Warning: mysql_close() expects parameter 1 to be resource, null given in /Users/me/Sites/mysite/add.php on line 172

So from that I think I need to set permissions on that folder. Any ideas?

Upvotes: 4

Views: 50398

Answers (4)

ccyarm
ccyarm

Reputation: 1

I had the same problem. I did a move_uploaded_file() to a folder I knew IIS users have writing permissions then I unzip that file. By default my PHP.ini is using c:\windows\temp and even if I gave writing permissions to IIS users it wasn't working.

Upvotes: 0

webbiedave
webbiedave

Reputation: 48887

Warning: imagejpeg(): Unable to open 'upload/thumbs/AL.jpg' for writing: Permission denied in /Users/tom/Sites/tombrennand/add.php on line 128

You need to set the write permission on folder upload/thumbs

Since this is your personal computer, you can just cd into folder upload and then chmod 777 thumbs in Terminal.

Upvotes: 1

Ryan
Ryan

Reputation: 28227

Change the

upload_tmp_dir = /tmp/whatever

entry in your php.ini file. Ensure that this location is writable by the appropriate user/group.

Upvotes: 3

dtbarne
dtbarne

Reputation: 8210

View your phpinfo in a new page to see what it is set to:

<?php phpinfo(); ?>

If it isn't where you need it to be, you can edit it with your php.ini file.

Upvotes: 0

Related Questions