Home
Forums
Members
Search
Help
New topics
Todays topics
Website
Welcome Guest, Not a member yet?
Register
Sign In
Login
Username:
Password:
Remember me
Lost Password?
CodeIgniter Forums
Development
CodeIgniter 3.x
how to upload a json file?
Share on Google
Share on Facebook
Share on Twitter
View a Printable Version
Subscribe to this thread
Add Poll to this thread
Send thread to a friend
Linear Mode
Threaded Mode
how to upload a json file?
Kaushik
Newbie
Posts:
1
Threads:
1
Joined:
Jan 2020
Reputation:
0
#1
01-21-2020, 02:45 AM
I tried with the below code, but its showing "
The filetype you are attempting to upload is not allowed.". Can someone please help me with this
public function do_upload()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'jpg|png|php|json';
$config['detect_mime'] = 'True';
$config['max_size'] = 1024;
$this->load->library('upload', $config);
$data['value']=$this->input->post('company_id');
if ( ! $this->upload->do_upload('userfile'))
{
$data['error']=$this->upload->display_errors();
$data['results']=$this->Users_model->get_brands("1");
$this->load->view('add_gajson', $data);
}
else
{
$data['results']=$this->Users_model->get_brands("1");
$this->load->view('add_gajson', $data);
}
}
Reply
php_rocs
Administrator
Posts:
1,392
Threads:
79
Joined:
Jun 2016
Reputation:
72
#2
01-21-2020, 07:36 AM
@
Kaushik
,
Are you sure that the file that you are trying to upload is one of the types allowed?
Reply
jreklund
Administrator
Posts:
1,408
Threads:
3
Joined:
Aug 2017
Reputation:
42
#3
01-21-2020, 11:27 AM
I would allow txt as it's most likely getting flagged as an text file instead of json.
Reply
--------------------
Private Messages
User Control Panel
Who's Online
Search
Forum Home
General
-- News & Discussion
-- Events
-- Lounge
-- Regional User Groups
Using CodeIgniter
-- Installation & Setup
-- Model-View-Controller
-- Libraries & Helpers
-- Best Practices
-- Choosing CodeIgniter
-- General Help
CodeIgniter 4
-- CodeIgniter 4 Roadmap
-- CodeIgniter 4 Development
-- CodeIgniter 4 Feature Requests
-- CodeIgniter 4 Support
-- CodeIgniter 4 Discussion
-- CodeIgniter 4 Addins
Development
-- CodeIgniter 3.x
-- CodeIgniter 2.x
-- Issues
-- NetBeans Plugin
External Resources
-- Spotlight
-- Learn More
-- Jobs
-- Addins
Archived Discussions
-- Archived Libraries & Helpers
-- Archived Development & Programming
Theme © iAndrew 2016 -
Forum software by © MyBB