# Uploading image through web problem permission



## munir (Dec 14, 2010)

Hi..

FreeBSD members,

Hi.. All

Recently we migrate os from centos to FreeBSD 8.1, since at centos no issue permissions. Now we have problem permission issue with FreeBSD.

We are running phpnuke and have little modified at script for uploading image news article. When we uploading result successful after submit we show to front pages no image available.

http://www.utaraonline.net/v4/index.php  < 2 article no images.

I've already chmod folder and chown but still same issue.

Result below:


```
drwxrwxrwx   4 utara   apache    3072 Dec 15 00:05 .
drwxr-xr-x  18 utara   apache    3584 Dec 11 00:45 ..
-rw-r--r--   1 utara   apache  100381 Nov 30 21:02 0022890001291122142.jpg
-rw-r--r--   1 utara   apache  117372 Nov 30 19:56 0196067001291118206.jpg
[color="Red"][B]-rw-r--r--   1 apache  wheel        0 Dec 12 15:51 0244645001292140269.jpg[/B][/color]
-rw-r--r--   1 utara   apache   86242 Nov 29 23:19 0298871001291043985.jpg
-rw-r--r--   1 utara   apache   86242 Nov 30 00:08 0751842001291046929.jpg
-rw-r--r--   1 utara   apache  136253 Nov 30 00:11 0759488001291047103.jpg
-rw-r--r--   1 utara   apache   86242 Nov 29 23:45 0772754001291045554.jpg
-rw-r--r--   1 utara   apache  118389 Nov 30 19:36 0777235001291116975.jpg
[color="Red"][B]-rw-r--r--   1 apache  wheel        0 Dec 15 00:05 0871468001292342757.jpg[/B][/color]
```

And wheel will take over that permissions after uploading done.


----------



## munir (Dec 14, 2010)

Thank DutchDaemon

One more informations.
after uploading done image size will be zero bytes.


----------



## JohnR (Dec 15, 2010)

I see the permissions on the directory seem to be 777 which is pretty wide open. Wouldn't it be an idea to put a setuid bit on the directory (4750 perhaps) to force the directory permissions and not have to rely on some process to change ownership and permissions?


----------



## SirDice (Dec 15, 2010)

Owner, group and permissions aren't the problem. The file is world readable so the web server is able to read it.

Because the uploaded files are 0 bytes I suspect there's a fault in the code that allows the upload.


----------



## JohnR (Dec 15, 2010)

Perhaps there might not be enough space available / anything wrong permission wise in the upload_tmp_dir which is used by php?


----------



## munir (Dec 20, 2010)

SirDice said:
			
		

> Owner, group and permissions aren't the problem. The file is world readable so the web server is able to read it.
> 
> Because the uploaded files are 0 bytes I suspect there's a fault in the code that allows the upload.



Yes sir.

today i was checked the log on /var/log/httpd/error_log.3 and  /var/log/httpd/error_log.3



```
Wrong JPEG library version: library is 70, caller expects 62
Wrong JPEG library version: library is 70, caller expects 62
Wrong JPEG library version: library is 70, caller expects 62
Wrong JPEG library version: library is 70, caller expects 62
Wrong JPEG library version: library is 70, caller expects 62
Wrong JPEG library version: library is 70, caller expects 62
```


----------



## munir (Dec 20, 2010)

I was tested with others format .png working properly
instead jpg not work when uploaded.

system upload currently ok but auto resize and crop not work.


----------

