Create php MVC application. Upload CSV file

Главная » Tutorials » PHP+MySQL » Create php MVC application. Upload CSV file

One of subscribers asked me to shoe CSV file uploading and handling it in our app. In this lesson we’ll upload CSV file, read data from it and record data from file to application database

While uploading any type of file to the server we must notice several key concepts:

  • You need attribute enctype with multipart/form-data value to html form
  • Input with type “file” mus be in html form. Other types are not prohibited
  • While sending file to the server you can access to it from super global array – $_FILES. But html form still must have method post attribute.
  • While uploading file you must notice your server settings – file must be large, php script needs time to upload and handle it. That’s why you should check max execution time setting. Moreover, file uploading operation can fail, if its size more than server settings. That’s why you should check upload_max_filesize and post_max_size settings.
  • File don’t upload to the desired folder at once. It uploads to the temporary directory. You must upload file from temporary directory to your server desired directory using move_uploaded_file function.

Подписаться на рассылку

Будьте в курсе - получайте последние статьи на свой email

Ваша подписка успешно оформлена

Pin It on Pinterest

Share This