Welcome Guest, Not a member yet? Register   Sign In
Upload error - The file could not be written to disk
#1

[eluser]PermanaJ[/eluser]
Im trying to upload image, but I get this error message

"The file could not be written to disk"

Dont want to get confuse with file permission, i set the folder 777. What could be the reason that error happen ? I use this setting :

Code:
...

$upload_cfg['upload_path'] ='./images/photos/';
$upload_cfg['allowed_types'] = 'gif|jpg|png';
$upload_cfg['max_size']    = '200';
$upload_cfg['max_width']  = '200';
$upload_cfg['max_height']  = '200';
$upload_cfg['encrypt_name'] = true;

...
#2

[eluser]TheFuzzy0ne[/eluser]
That error is actually a PHP error, not anything to do with CodeIgniter as such. There error is [url="http://uk3.php.net/features.file-upload.errors"]UPLOAD_ERR_CANT_WRITE[/url].

The obvious reason for it not working is that the permissions or not set correctly, so I'd suggest you check the directory really is writeable by trying to create a blank file in there with PHP, or using is_really_writable().

Another reason might be your allowed Web quota. If you're nearing the limit, you may not be able to write to the disk.
#3

[eluser]PermanaJ[/eluser]
I think no problem with the web quota, But I will try using the function that you suggest. Thanks for the reply

btw, when i try this code :
Code:
$isWriteable = is_really_writable('./images/photos/');
if($isWriteable){
    echo 'yes it is really writeable';
}else{
    echo 'no, it is not really writeable';
}

it result "yes it is really writeable", i haven't try creating blank file gonna try it in minutes
#4

[eluser]omar_yoi[/eluser]
Hi,

I have the same problem here,.. is there anyway to solve this problem?

Thanks
#5

[eluser]PermanaJ[/eluser]
@omar_yoi

i was posted this a year ago. I forgot how to solve this problem :| because when I trial and error it's just working. try using without . (dot) in file path ..
#6

[eluser]omar_yoi[/eluser]
I am using this code to explain the path to the images
Code:
$this->gallery_path = realpath(APPPATH . '../img');

I have tried to removed one dot (.) or both, however the following error message appears:
The upload destination folder does not appear to be writable.

otherwise if I did not remove it at all, the following message appears:
The file could not be written to disk.

I have no idea what is going on since I did not change the code at all, and I did not do any changes on the web server (FreeBSD Platform) as well.

Any other suggestion to solve the problem?

Thank you in advance.
#7

[eluser]omar_yoi[/eluser]
Ok, my problem solved.

I'm running on FreeBSD, my /var directory is already hit 100% capacity (full), so since the db was located under /var/db/ the database refused to write the file.

In my case, I moved all the directories which contain big size of data to /usr and made a symlink from /var to /usr. Then the size of /var directories was reduced 60% capacity, so that the database could continue to write the file.

Thanks to PermanaJ and TheFuzzy0ne for giving me the ideas of what causing the problem.




Theme © iAndrew 2016 - Forum software by © MyBB