Welcome Guest, Not a member yet? Register   Sign In
File Upload Bug for Thai Language
#1

[eluser]DominixZ[/eluser]
I found bug that when I upload my thai name pic with File Uploading Class

It will convert from this

รูปภาพตัวเอง.jpg

to this

เธฃเธนเธ›เธ_เธฒเธžเธ•เธฑเธงเน€เธญเธ‡.jpg

and in the dabase will be

รูป

I know the solution for this (set 'encrypt_name' to TRUE) but I want it to not encrypt my file name. How can i fix this bug? Help me plz.
#2

[eluser]Iván Argulo[/eluser]
Could you transcript the filenames? Sadly, I don't understand Thai...

Setting the 'encrypt_name' to true will encode the filename, no matter anything else.
#3

[eluser]DominixZ[/eluser]
Here is my thai pic name.
#4

[eluser]Iván Argulo[/eluser]
You posted the image, not the name Wink anyway, you can choose a filename for your new uploaded file. How do you get the filename? Could you post some code?
#5

[eluser]DominixZ[/eluser]
Sorry, This is my file name "รูปภาพตัวเอง.jpg"
Code:
if (!$answer_broken && ! $this->upload->do_upload($upload_files)){
    $upload_success = false;
    $upload_error = array('error' => $this->upload->display_errors());
    $errors = '';
    foreach ($upload_error as $error){
        $errors .= $error;
    }
    $data['errors'] = $errors;
    $this->load->view('register',$data);            
}else{
    $pic_data =  $this->upload->data();
    if(isset($pic_data['picture']['file_name'])){
        $subscriber->picture_path = $pic_data['picture']['file_name'];
    }
    if(isset($pic_data['portfolio']['file_name'])){
        $subscriber->portfolio_path = $pic_data['portfolio']['file_name'];
    }
    if(isset($pic_data['file_name'])){
        $subscriber->picture_path = $pic_data['file_name'];
    }
        $subscriber->save();
}

This is my code that do_upload() and save information to database (I use DataMapper for Model)




Theme © iAndrew 2016 - Forum software by © MyBB