# File upload Error 2 (Import CSV to Dataset)

**URL:** https://community.xibo.org.uk/t/file-upload-error-2-import-csv-to-dataset/9540
**Category:** Get Help
**Created:** [April 8, 2017, 7:20pm UTC](https://community.xibo.org.uk/t/file-upload-error-2-import-csv-to-dataset/9540 "2017-04-08T19:20:03Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Tsaukpaetra](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/tsaukpaetra/32/2808_2.png) [@Tsaukpaetra](https://community.xibo.org.uk/u/Tsaukpaetra)
#### Post date: [April 8, 2017, 7:20pm UTC](https://community.xibo.org.uk/t/file-upload-error-2-import-csv-to-dataset/9540/1 "2017-04-08T19:20:03Z")

</div>

Got “The file exceeds the maximum allowed file size. [Code 2]”, while attempting to import CSV, despite my PHP.ini being set correctly, even according to [this topic](https://community.xibo.org.uk/t/the-file-exceeds-the-maximum-allowed-file-size-code-2-with-small-csv/6759).

I’ve even tried uploading a zero-byte file, though that ended up with Code 4.

I’m on Version 1.7.9.

---

<div class="post-metadata">

### Author: ![Tsaukpaetra](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/tsaukpaetra/32/2808_2.png) [@Tsaukpaetra](https://community.xibo.org.uk/u/Tsaukpaetra)
#### Post date: [April 8, 2017, 9:43pm UTC](https://community.xibo.org.uk/t/file-upload-error-2-import-csv-to-dataset/9540/2 "2017-04-08T21:43:44Z")

</div>

I was clued in on this comment on StackOverflow:

> <https://stackoverflow.com/questions/9779221/file-upload-error-2>

> I’m also facing this error and I’ve noticed it’s because the maximum file size specified in “value” should be a power of 2. In particular, I was setting value=“500000” and I’ve turned it to value=“524288”

Apparently something wrong with converting `2G` to whatever number PHP likes in the upload form?

In the Media Uploader (which works) this field is: `2147483648`, but isn’t included as MAX\_FILE\_SIZE. 😕

---

<div class="post-metadata">

### Author: ![Peter](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/peter/32/8154_2.png) [@Peter](https://community.xibo.org.uk/u/Peter)
#### Post date: [April 10, 2017, 9:43am UTC](https://community.xibo.org.uk/t/file-upload-error-2-import-csv-to-dataset/9540/3 "2017-04-10T09:43:35Z")

</div>

The issue is only regarding dataset imports? All other uploads (images, videos) are working fine?

Could you double check all php.ini settings (and any notes regarding your environment if applicable? - [How do I upload files bigger than 2MB / How can I increase the upload file size limit?](https://community.xibo.org.uk/t/how-do-i-upload-files-bigger-than-2mb-how-can-i-increase-the-upload-file-size-limit/27)

Do you have any special characters in data set name, columns etc?

---

<div class="post-metadata">

### Author: ![Tsaukpaetra](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/tsaukpaetra/32/2808_2.png) [@Tsaukpaetra](https://community.xibo.org.uk/u/Tsaukpaetra)
#### Post date: [April 10, 2017, 6:25pm UTC](https://community.xibo.org.uk/t/file-upload-error-2-import-csv-to-dataset/9540/4 "2017-04-10T18:25:18Z")

</div>

so for this topic, yes the issue is only with the file upload part.

All other uploads seem to work fine, php.ini is all good, this really shouldn’t be happening.

---

<div class="post-metadata">

### Author: ![Peter](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/peter/32/8154_2.png) [@Peter](https://community.xibo.org.uk/u/Peter)
#### Post date: [April 11, 2017, 9:16am UTC](https://community.xibo.org.uk/t/file-upload-error-2-import-csv-to-dataset/9540/5 "2017-04-11T09:16:08Z")

</div>

Could you perhaps send me the .csv file via private message so I can try it in our environment?

Alternatively you could order demo cms instance hosted with spring signage and try to recreate the issue there - that should help us to know where the problem could be.

---

<div class="post-metadata">

### Author: ![Tsaukpaetra](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/tsaukpaetra/32/2808_2.png) [@Tsaukpaetra](https://community.xibo.org.uk/u/Tsaukpaetra)
#### Post date: [April 12, 2017, 2:59am UTC](https://community.xibo.org.uk/t/file-upload-error-2-import-csv-to-dataset/9540/6 "2017-04-12T02:59:10Z")

</div>

> [@Peter](#):
>
> .csv file via private message

Ah… file upload types are limited in this install of Discourse.

Have a paste!

> **[CSV import - Pastebin.com](https://pastebin.com/wEwwy9rK)**
>
> Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.

This file does suffer a bit from MS Excel adding SmartQuotes and other such characters, but the issue occurs before the actual import, so I figure it’s fine.

Side note: This file (even with special characters removed) will fail to import, because for some reason the value column in the database is set to 255 characters, and there are quite a few description cells that are much longer than that (almost double even).

---

<div class="post-metadata">

### Author: ![Peter](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/peter/32/8154_2.png) [@Peter](https://community.xibo.org.uk/u/Peter)
#### Post date: [April 12, 2017, 9:35am UTC](https://community.xibo.org.uk/t/file-upload-error-2-import-csv-to-dataset/9540/7 "2017-04-12T09:35:34Z")

</div>

1.7.9 does have that limit to 255 characters in a field - 1.8 does not have this problem anymore.

Other than that I imported your csv without any issues - the descriptions are cut if they were longer than 255 characters, but that’s only issue I had.

Could you double check everything in php.ini (and notes for specific environment if applicable) [How do I upload files bigger than 2MB / How can I increase the upload file size limit?](https://community.xibo.org.uk/t/how-do-i-upload-files-bigger-than-2mb-how-can-i-increase-the-upload-file-size-limit/27)

---

<div class="post-metadata">

### Author: ![Tsaukpaetra](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/tsaukpaetra/32/2808_2.png) [@Tsaukpaetra](https://community.xibo.org.uk/u/Tsaukpaetra)
#### Post date: [April 13, 2017, 3:52am UTC](https://community.xibo.org.uk/t/file-upload-error-2-import-csv-to-dataset/9540/8 "2017-04-13T03:52:03Z")

</div>

> [@Peter](#):
>
> Could you double check everything in php.ini (and notes for specific environment if applicable) [How do I upload files bigger than 2MB / How can I increase the upload file size limit?](https://community.xibo.org.uk/t/how-do-i-upload-files-bigger-than-2mb-how-can-i-increase-the-upload-file-size-limit/27)

Yeah, everything seems fine as indicated by the non-problem with the media upload section.

My settings are as follows:

php.ini:

```auto
post_max_size = 2G
upload_max_filesize = 2G

```

nginx.conf:

```auto
        client_max_body_size 2G;

```

I’m pretty sure it’s just a glitch in how PHP is interpreting the form parameter MAX\_FILE\_SIZE that appears only in the CSV importer and not in the media upload tool, as the moment I modify the DOM to eliminate it from the submission, it works. It’s possible it works in other situations because the calculations for 500M or 20M or whatever _do_ correctly expand out to whatever PHP is expecting, but 2G does not.

---

<div class="post-metadata">

### Author: ![Peter](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/peter/32/8154_2.png) [@Peter](https://community.xibo.org.uk/u/Peter)
#### Post date: [April 13, 2017, 9:10am UTC](https://community.xibo.org.uk/t/file-upload-error-2-import-csv-to-dataset/9540/9 "2017-04-13T09:10:53Z")

</div>

I believe we’ve encountered some issue when the limits were set to 2G (or more), you could try to go with `1999M` that’s what we have in our cloud hosting settings as well as I believe in docker.

---

<div class="post-metadata">

### Author: ![Amila\_Perera](https://community.xibo.org.uk/user_avatar/community.xibo.org.uk/amila_perera/32/6349_2.png) [@Amila\_Perera](https://community.xibo.org.uk/u/Amila_Perera)
#### Post date: [November 28, 2018, 5:40am UTC](https://community.xibo.org.uk/t/file-upload-error-2-import-csv-to-dataset/9540/10 "2018-11-28T05:40:27Z")

</div>

> [@Tsaukpaetra](#):
>
> upload\_max\_filesize

Hi guys  
Cant upload more than 7 m i changed setting to 2G but its says below

SyntaxError: Unexpected token \< in JSON at position 0

---

<div class="post-metadata">

### Author: ![system](https://community.xibo.org.uk/uploads/default/original/2X/a/a8759c2d8cc561474733895ac75beeb830f5d8ca.png) [@system](https://community.xibo.org.uk/u/system)
#### Post date: [March 4, 2020, 5:07pm UTC](https://community.xibo.org.uk/t/file-upload-error-2-import-csv-to-dataset/9540/11 "2020-03-04T17:07:02Z")

</div>


