Функция do_upload() удаляет символ «&» из имени файла в Codeigniter 3.Php

Кемеровские программисты php общаются здесь
Ответить
Гость
 Функция do_upload() удаляет символ «&» из имени файла в Codeigniter 3.

Сообщение Гость »


I'm using do_upload() function in CI3, to rename & upload a file. The file name contains '&' character. When i upload a file and save it, the '&' character from file name is getting remove. Below is the code -

// Upload File Name : ***Heavy & Light Vehicles.csv*** // File post parameter : *im_file* $config['file_name'] = $saved_file_name = uniqid() . '_' . $_FILES['im_file']['name']; $config['allowed_types'] = 'csv'; $config['overwrite'] = TRUE; $this->load->library('upload'); $this->upload->initialize($config); if (!$this->upload->do_upload('im_file')) { $error = array('error' => $this->upload->display_errors()); $im_file = ""; exit(); } else { $filedata = array('upload_data' => $this->upload->data()); print_r($filedata); } The array printed as below -

[upload_data] => Array ( [file_name] => 65e5c1262de2d_Heavy_Light_Vehicles.csv [file_type] => text/plain [file_path] => D:/wamp/www/project_folder/uploads/import_file/vehicles/ [full_path] => D:/wamp/www/project_folder/uploads/import_file/vehicles/65e5c1262de2d_Heavy_Light_Vehicles.csv [raw_name] => 65e5c1262de2d_Heavy_Light_Vehicles.csv [orig_name] => 65e5c1262de2d_Heavy_Light_Vehicles.csv [client_name] => Heavy & Light Vehicles.csv [file_ext] => .csv [file_size] => 99.2 [is_image] => [image_width] => [image_height] => [image_type] => [image_size_str] => ) In above printed 'file upload' array, the '&' character from file name got removed while saving it. Expected file name after save should be 65e5c1262de2d_Heavy_&_Light_Vehicles.csv. Please suggest if there is any solution to keep file name '&' character as it is.


Источник: https://stackoverflow.com/questions/781 ... eigniter-3
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Php»