Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

The solution to the "You did not select a file to upload" error when uploading pictures on Codeigniter

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains the solution of "You did not select a file to upload" error in uploading pictures on Codeigniter. Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Next let the editor to take you to learn the "Codeigniter upload pictures appear" You did not select a file to upload "error solution" bar!

The file upload class that comes with Codeigniter is very easy to use. You can set and specify a certain type of file to be uploaded and a file of specified size. However, you need to pay attention to some minor problems in the process of use, otherwise you will be caught off guard.

Many developers always have a "You did not select a file to upload" error when uploading classes using Codeigniter's upload, and there is no error in the code. What's going on?

1. The name of the file domain has been modified

Method 1:

For example, change the name of the file field of the Views file to fileimg, while the default name of the CI file field is userfile, which looks like:. This cannot be modified, otherwise the uploaded file will not be found.

Here's how it works: $this- > upload- > do_upload () the default form for uploading files is userfile.

Method 2:

In fact, there is a solution, if the file field is another name. For example:

Set

The copy code is as follows:

$this- > upload- > do_upload ()

Change to

The copy code is as follows:

$this- > upload- > do_upload ('imgfile')

That's it!

2. Form form type

Form forms need to use form_open_multipart, and when you form a HTML, you will add an attribute enctype= "multipart/form-data". This is actually common sense, just pay attention.

At this point, I believe that everyone on the "Codeigniter upload pictures appear" You did not select a file to upload "error solution" have a deeper understanding, might as well to the actual operation of it! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report