4

I have a php uploader as below

<form enctype="multipart/form-data" action="jsonlog.php" method="POST"> <!-- MAX_FILE_SIZE must precede the file input field --> <input type="hidden" name="MAX_FILE_SIZE" value="30000" /> <!-- Name of input element determines name in $_FILES array --> Send this file: <input name="file" type="file" /> <input type="submit" value="Send File" /> </form> 

In the jsonlog.php:

if($_FILES['file']['error']>0) { echo "Reading Error: " . $_FILES['file']["error"] . "<br />"; } else { code to process } 

It passed on my localhost, but when I tried on a linux server, it always gave me error:

UPLOAD_ERR_CANT_write Value: 7,failed to write file to disk. Anyone knows how to solve it?

Thanks


Yes, I checked the tmp directory permission, see below

drwxrwxrwx 2 bitnami bitnami 4096 2011-09-21 13:34 tmp 

I can created a new file in the tmp using command like

sudo vi test.txt 

the uploader still returns the error PLOAD_ERR_CANT_write.

There is one more thing that I don't understand: I log in as bitnami, I should have full control to the folder tmp, but I cannot write files into tmp using command without sudo

vi t.txt 

I cannot save the changes. It returns this error

E514: write error (file system full?) WARNING: Original file may be lost or damaged don't quit the editor until the file is successfully written! 

Here is the output of df command

 Filesystem Size Used Avail Use% Mounted on /dev/sda1 9.9G 9.4G 0 100% / devtmpfs 854M 116K 854M 1% /dev none 871M 0 871M 0% /dev/shm none 871M 48K 871M 1% /var/run none 871M 0 871M 0% /var/lock none 871M 0 871M 0% /lib/init/rw /dev/sda2 335G 195M 318G 1% /mnt 

but when I run sudo du -sh, the output is

/$ sudo du -sh / du: cannot access `/proc/32760/task/32760/fd/4': No such file or directory du: cannot access `/proc/32760/task/32760/fdinfo/4': No such file or directory du: cannot access `/proc/32760/fd/4': No such file or directory du: cannot access `/proc/32760/fdinfo/4': No such file or directory 855M / 

It is far from full. Anybody can tell me why?

1 Answer 1

3

Have you checked if the directory is writeable / have you checked all permissions? The error says you can't write the file, due to permissions problems..

Sign up to request clarification or add additional context in comments.

2 Comments

Running out of disk space is another reason. If /tmp is size-constrained, an upload could very well fill it up.
yes, this problem is due to running out of disk space. Thanks

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.