CodeIgniter Forums

Full Version: Return of "File upload issues with CodeIgniter…? "
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]Dr. Seuss[/eluser]
Hello All. I originally added this to another thread, but thought that it might deserve its own topic after much investigation.

UPDATE: I wanted to validate that the file was making it to the server from the form; used this

echo "FILES--";

...and got this result:

Quote:FILES--Array ( [userfile] => Array ( [name] => custom.txt [type] => text/plain [tmp_name] => /tmp/php0Opxtb [error] => 0 [size] => 80 ) ) obviously things are making it "up" just not getting processed to my "uploads" directory by the "File Uploading Class".


I have followed the suggestions in this thread for debugging; have verified that I can detect a folder and file's existence (independently), but don't seem to be able to upload a file. The code is thus

$this->load->helper(array('form', 'url'));
$up['upload_path'] = './uploads/';
$up['allowed_types'] = 'doc|txt|odf|sql';
$up['max_size']    = '2048';
$this->load->library('upload', $up);

$ermsg = $this->upload->display_errors();
$data = $this->upload->data();
echo "<br>";
echo "data<br>";
echo "<br>";
echo "err<br>";

...which returns the following:

Quote:woohoo, folder and file found
Array ( [file_name] => [file_type] => [file_path] => ./uploads/ [full_path] => ./uploads/ [raw_name] => [orig_name] => [file_ext] => [file_size] => [is_image] => [image_width] => [image_height] => [image_type] => [image_size_str] => )

In the original thread, the culprit was the lack of "../" (double dot, forward slash). In my case the "single dot, forward slash" is required because my structure is:

+ www/

...but as noted above, I can detect the presence of a test file using this code:

echo "woohoo, folder and file found";
echo "not found";

"$this->upload->display_errors()" does not appear to return any errors, either.

From Perusing StackOverflow, there were "upload class" posts there where the following suggestions resolved the user's issue:

--chmod the "uploads" dir to "755" instead of "777" per the manual. I tried this with no discernible effect.
--Use doc root per this:
$up['upload_path'] =$_SERVER['DOCUMENT_ROOT'] . '/' .'uploads/';

...again, this made no improvement for me. I did add as second "test" to see if I could get o my file with the doc root construct, like so:
  echo "found it using doc root var";
    echo "not found";

...and it works just like the relative, non-explicit path worked above.

I have been searching the forums and have not found anyone else who has reported that "file_path" and 'full_path" array values would be populated with no other returned values. Makes no sense; if the function is succeeding to the degree that these two array values would be filled, why not the other values and the file appear in the "uploads" dir?

Quote: [upload_data] => Array
[file_name] =>
[file_type] =>
[file_path] => /home/sosh/www/uploads/
[full_path] => /home/sosh/www/uploads/
[raw_name] =>
[orig_name] =>
[file_ext] =>
[file_size] =>
[is_image] =>
[image_width] =>
[image_height] =>
[image_type] =>
[image_size_str] =>


Lastly, I do not know if the fact that I am hosting on Dreamhost is germane to this problem or not.

Any and all further ideas for tracking the down the source of the problem would be appreciated.