# 按文件名顺序上传图片

**URL:** <https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147>\
**Category:** Feature\
**Created:** [2018年八月20日 05:11 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147 "2018-08-20T05:11:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ron\_jeremy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ron_jeremy/32/56621_2.png) [@ron\_jeremy](https://meta.discourse.org/u/ron_jeremy)\
**Post date:** [2018年八月20日 05:11 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/1 "2018-08-20T05:11:30Z")

</div>

Is it possible to have images that are uploaded & inserted into a post to appear in order by filename?

For example: if I select the following images (1.jpg, 2.jpg, 3.jpg, 4.jpg, 5.jpg) on my computer & upload them into a post (using the editor’s file upload icon) they seem to be inserted in a random order (it’s not by filename or size). This makes inserting images into “How To” posts or tutorials or anything where a timeline needs to be preserved very tedious because images would have to be inserted one at a time in order to preserve the coherency of the post.

Is this a CP setting I’ve missed or just the way things are?

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2018年八月20日 05:13 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/2 "2018-08-20T05:13:34Z")

</div>

Interesting use case, I think it is a reasonable feature request to sort by name if you are trying to upload multiple things. Though I wonder “if this is the correct default” why is the operating system not taking care of it?

---

<div class="post-metadata">

**Author:** ![ron\_jeremy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ron_jeremy/32/56621_2.png) [@ron\_jeremy](https://meta.discourse.org/u/ron_jeremy)\
**Post date:** [2018年八月20日 05:17 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/3 "2018-08-20T05:17:39Z")

</div>

> [@sam](#):
>
> Though I wonder “if this is the correct default” why is the operating system not taking care of it?

Hi @sam, I’m not sure what you mean by that.

Here’s another example of what I’m trying to explain: if I use my camera to take pics during a 7 day motorcycle ride, all those pics will be sorted by filename (DSC\_001, DCS\_002, etc.) which presents the chronological order the pics were taken. What I’d like to see is simply for that order to be preserved when selecting those pics & uploading them into a post.

---

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [2018年八月20日 05:25 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/4 "2018-08-20T05:25:04Z")

</div>

> [@ron\_jeremy](#):
>
> Hi @sam, I’m not sure what you mean by that.

I mean. We are not getting the filenames in random order, we are getting them in the order the operating system supplies them to the web browser.

---

<div class="post-metadata">

**Author:** ![ron\_jeremy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ron_jeremy/32/56621_2.png) [@ron\_jeremy](https://meta.discourse.org/u/ron_jeremy)\
**Post date:** [2018年八月20日 05:25 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/5 "2018-08-20T05:25:45Z")

</div>

Here I have selected pics 1.jpg thru 5.jpg & uploaded them to this post:

 ![1](https://global.discourse-cdn.com/meta/original/3X/e/e/ee8c56756e50f3789c364516ed80fb97a42a5145.jpeg)

 ![3](https://global.discourse-cdn.com/meta/original/3X/d/b/dbde41d88a949bb49ffb37be1bad54c6b561ab63.jpeg)

 ![4](https://global.discourse-cdn.com/meta/original/3X/9/5/956599c34491aebe21f322b759332b2e1ef0173e.jpeg)

 ![5](https://global.discourse-cdn.com/meta/original/3X/6/9/69d9fc51f3476a875ef4cbe2395351b8cfd8e03f.jpeg)

 ![2](https://global.discourse-cdn.com/meta/original/3X/3/9/39c556d25a6875e708c06e577a977164e4adb289.jpeg)

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2018年八月20日 05:25 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/6 "2018-08-20T05:25:52Z")

</div>

What order did you click on the files in the operating system. Let’s try a test:

 ![png_fixed](https://global.discourse-cdn.com/meta/original/3X/8/a/8add6c1694420914b108127786f536a46c826117.jpeg)

Here’s me clicking on `1.png`, then `2.png`, then `3.png`, _in that order_, and uploading them:

 ![1](https://global.discourse-cdn.com/meta/original/3X/b/6/b666902f0b9d45745ba8977553828b431941edf8.png) ![2](https://global.discourse-cdn.com/meta/original/3X/6/c/6c27b0f0eafa84ef9787ac4b36f28f960ce44eb6.png) ![3](https://global.discourse-cdn.com/meta/original/3X/a/3/a32610fca7523a7b695c1e109b46b7d079b4e571.png)

Looks in order to me..

Let me try again with different images, and I’ll click on them in reverse order, `3.jpg` → `2.jpg` → `1.jpg`

 ![jpg_fixed](https://global.discourse-cdn.com/meta/original/3X/3/1/318218ea4c8eecb58e2d580376bc3f6cd706f0e9.jpeg) ![jpg_fixed](https://global.discourse-cdn.com/meta/original/3X/9/a/9ab8a372f0ebabf33d1d97a61142a3d930b5befa.jpeg) ![jpg_fixed](https://global.discourse-cdn.com/meta/original/3X/0/c/0c1287edfdb154a67b0f304ba34e002a9eeca654.jpeg)

Not entirely sure what happened there, that looks like 2, 1, 3 to me.

---

<div class="post-metadata">

**Author:** ![ron\_jeremy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ron_jeremy/32/56621_2.png) [@ron\_jeremy](https://meta.discourse.org/u/ron_jeremy)\
**Post date:** [2018年八月20日 05:26 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/7 "2018-08-20T05:26:29Z")

</div>

> [@sam](#):
>
> I mean. We are not getting the filenames in random order, we are getting them in the order the operating system supplies them to the web browser.

Ok, I can understand that. Is there any way to uhhhh change this?

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2018年八月20日 05:27 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/8 "2018-08-20T05:27:06Z")

</div>

I suggest starting by putting just the target images in a folder by themselves to test.

---

<div class="post-metadata">

**Author:** ![ron\_jeremy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ron_jeremy/32/56621_2.png) [@ron\_jeremy](https://meta.discourse.org/u/ron_jeremy)\
**Post date:** [2018年八月20日 05:27 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/9 "2018-08-20T05:27:26Z")

</div>

> [@codinghorror](#):
>
> What order did you click on the files in the operating system.

I select 1.jpg then hold shift & select 5.jpg.

---

<div class="post-metadata">

**Author:** ![ron\_jeremy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ron_jeremy/32/56621_2.png) [@ron\_jeremy](https://meta.discourse.org/u/ron_jeremy)\
**Post date:** [2018年八月20日 05:30 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/10 "2018-08-20T05:30:05Z")

</div>

> [@codinghorror](#):
>
> I suggest starting by putting just the target images in a folder by themselves to test.

That is usually the case. For example there’d by a GoPro folder with a bunch of images sorted by filename (and thus by timestamp). Selecting 20 images to create a ride report for a multi day ride doesn’t yield the correct chronological order where one could simply add a gap between each image & enter whatever relevant text applies then move on to the next image.

Every image would need to be inserted **one. at. a. time**.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2018年八月20日 05:36 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/11 "2018-08-20T05:36:26Z")

</div>

Let me try shift-selecting all images in this folder. Here goes, shift-select the range.. wait, I already see a problem! Note the circled area in the screenshot:

 ![png_fixed](https://global.discourse-cdn.com/meta/original/3X/7/c/7c3b33ba43654c26f536d8b8c52d2fc7c39b6df9.jpeg)

Now let me try again shift+clicking each one.. wow **nope!** No change! Windows apparently really wants those files sent in that weird order, maybe it’s a “human sort” issue? Let me try renaming them.. wow! _Nope!_

 ![png_fixed](https://global.discourse-cdn.com/meta/original/3X/d/8/d8e1c82266832ac043a05be3cf69e2e029e95ad7.jpeg)

Note the filename area again ↑ ↑

🤣 here’s what works. **Click the files you want to upload in _reverse order of number_**. Therefore I am shift-clicking 8, 7, 6, 5, 4 and I get…

 ![png_fixed](https://global.discourse-cdn.com/meta/original/3X/0/9/090f9342021c1ae6f09315c9b6ebc935f50f9791.jpeg)

Which looks good, and when uploaded..

 ![jpg_fixed](https://global.discourse-cdn.com/meta/original/3X/9/9/99ba7aaf6e9f7acf80017c2e17ac040149d14b49.jpeg) ![jpg_fixed](https://global.discourse-cdn.com/meta/original/3X/b/2/b24b515adaea3fb8373a46268e7f803c21ff0eb3.jpeg) ![jpg_fixed](https://global.discourse-cdn.com/meta/original/3X/7/d/7d758f438d0305c09b3278caa1a436d776d480c3.jpeg) ![jpg_fixed](https://global.discourse-cdn.com/meta/original/3X/c/9/c94638e2875f13bf06a5f32822f7e54e983e4d92.jpeg) ![jpg_fixed](https://global.discourse-cdn.com/meta/original/3X/0/d/0da881fa08d0fa8ea3f9fa72ec589716c41ebdc3.jpeg)

Upload _also_ looks good. So this is definitely an operating system / browser issue, nothing to do with Discourse.

---

<div class="post-metadata">

**Author:** ![Mittineague](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mittineague/32/114259_2.png) [@Mittineague](https://meta.discourse.org/u/Mittineague)\
**Post date:** [2018年八月20日 05:42 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/12 "2018-08-20T05:42:43Z")

</div>

A pop instead of a shift so the indexes don’t need to be revised?

---

<div class="post-metadata">

**Author:** ![ron\_jeremy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ron_jeremy/32/56621_2.png) [@ron\_jeremy](https://meta.discourse.org/u/ron_jeremy)\
**Post date:** [2018年八月20日 05:50 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/13 "2018-08-20T05:50:48Z")

</div>

> [@codinghorror](#):
>
> Upload _also_ looks good. So this is definitely an operating system / browser issue, nothing to do with Discourse.

Hi @codinghorror, I didn’t mean to imply it’s an issue with Discourse. Is there a possible “fix” from the Discourse side of things where attachments could be displayed in order of filename? Apologies if I’m asking for the moon here – it’s just my ignorance talking.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2018年八月20日 05:51 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/14 "2018-08-20T05:51:16Z")

</div>

The “fix” is to shift or ctrl click on the files in the correct order as determined by your operating system 😉

See my screenshots ↑

---

<div class="post-metadata">

**Author:** ![ron\_jeremy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ron_jeremy/32/56621_2.png) [@ron\_jeremy](https://meta.discourse.org/u/ron_jeremy)\
**Post date:** [2018年八月20日 05:53 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/15 "2018-08-20T05:53:34Z")

</div>

Yes, I fully understand that. I can tell my users to shift-click & (hopefully) remember to select images in a backwards oder, but I was hoping maybe Discourse could handle this automagically in a future update.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2018年八月20日 05:54 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/16 "2018-08-20T05:54:46Z")

</div>

Discourse is handling the files in the correct order that the operating system and browser is passing them to Discourse.

You may wish to file a bug with your OS vendor.

---

<div class="post-metadata">

**Author:** ![ron\_jeremy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ron_jeremy/32/56621_2.png) [@ron\_jeremy](https://meta.discourse.org/u/ron_jeremy)\
**Post date:** [2018年八月20日 05:56 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/17 "2018-08-20T05:56:56Z")

</div>

Already on that. Would you suggest starting with “Hey Tim” or “Dear Mr. Cook”?

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2018年八月20日 05:57 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/18 "2018-08-20T05:57:56Z")

</div>

It’s interesting that both Apple and Microsoft have this weird behavior, isn’t it?

I agree that it is totally bizarre that the OS wouldn’t respect the order in which you clicked or selected the files.

---

<div class="post-metadata">

**Author:** ![ron\_jeremy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ron_jeremy/32/56621_2.png) [@ron\_jeremy](https://meta.discourse.org/u/ron_jeremy)\
**Post date:** [2018年八月20日 06:03 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/19 "2018-08-20T06:03:05Z")

</div>

Now that I think of it, I notice the same behaviour when copying files to my NAS. If I select an album folder with a bunch of MP3 files (01 - song title.mp3, 02 - song title.mp3, etc.) they also seem to “land” on the server in random order.

---

<div class="post-metadata">

**Author:** ![TheBestPessimist](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/thebestpessimist/32/247704_2.png) [@TheBestPessimist](https://meta.discourse.org/u/TheBestPessimist)\
**Post date:** [2018年八月20日 08:04 UTC](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147/20 "2018-08-20T08:04:22Z")

</div>

Could it be the browser and not the OS?

[下一頁](https://meta.discourse.org/t/uploading-images-in-order-of-filename/95147.md?page=2)
