Welcome Guest, Not a member yet? Register   Sign In
Extraneous (hash?) files when doing file upload
#1

[eluser]georgeodowd[/eluser]
I'm working on my second full application using CodeIgniter, and I'm running into a funny little problem that neither I nor the server admin have been able to figure out. My job was to rewrite an old Perl app in PHP, and one of its functions is uploading photos. I've followed all the instructions in the user guide and it works as expected, except for one thing. Along with every image file that gets added to the designated folder, there is also what appears to be a hash(?) file, something along the lines of '482db0ecc10b8a9984ae850c9ada9899'. I can't find reference to anything in CodeIgniter that would be causing this, but the old Perl script didn't do this. In case it helps, we're running on a WAMP stack and the folders in question are protected by AD (Active Directory).
Any ideas on what might be happening? Thanks!
#2

[eluser]toopay[/eluser]
And how are your code looks like...
#3

[eluser]georgeodowd[/eluser]
[quote author="toopay" date="1311764684"]And how are your code looks like...[/quote]

I wasn't sure how much code would help here, as I don't think it's due to anything I've written, but FWIW:

controller function:
Code:
public function upload($fac_id) {
    $config['upload_path'] = '[path to my img dir]';
    $config['allowed_types'] = 'gif|jpg|png';
    $config['max_size'] = '1000';
    $config['max_width'] = '2000';
    $config['max_height'] = '2000';
    $config['encrypt_name'] = false;
    $config['remove_spaces'] = true;
        
    $this->load->library('upload', $config);
        
    if (!$this->upload->do_upload('photo_file')) {
        echo $this->upload->display_errors();
    } else {
        $photo_data = $this->upload->data();
        $this->Faculty_model->updatePhoto($fac_id, $photo_data['file_name']);
        redirect('editor/faculty_edit2/'.$fac_id);
    }
}

view:
Code:
<?php
    echo validation_errors();
    echo form_open_multipart('editor/upload/'.$fid);
?>
<br />
Upload File:&lt;input type="file" name="photo_file" value="Browse" size=70&gt;
<br /><br />
&lt;input type="submit" value="Upload"&gt;

&lt;?php echo form_close(); ?&gt;
#4

[eluser]toopay[/eluser]
Why
Code:
$config['encrypt_name'] = false;
present here? Unless you plan to converted file name to a random encrypted string (which i suspect happening right now), that line shouldn't present. Did you have any other config file for this or you just define them in your controller?
#5

[eluser]georgeodowd[/eluser]
[quote author="toopay" date="1311803839"]Why
Code:
$config['encrypt_name'] = false;
present here? Unless you plan to converted file name to a random encrypted string (which i suspect happening right now), that line shouldn't present. Did you have any other config file for this or you just define them in your controller?[/quote]

I am including that line specifically because I noticed the appearance of the anomalous hash files. Note that it is set to FALSE. In the CI user guide, it says this value is set to false by default, but I just wanted to be able to rule it out as a possible suspect by setting it explicitly in my code. Also note that these strange hash files are appearing in addition to the actual image files, which are correctly named. If I set 'encrypt_name' to true, I would expect to see the actual image file renamed, so I think this has to be a different issue.

Yes, this is the only place I am setting config values relating to file uploads.
#6

[eluser]toopay[/eluser]
For whatsoever reasons, that no way CI can produce that encrypted file, unless there was some typo or misconfiguration. Your best option would be : back up your app and re-install your LAMP.




Theme © iAndrew 2016 - Forum software by © MyBB