1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

Uploading images - case sensitivity

Discussion in 'Site Issues & Feedback' started by KeepItSimpleStupid, Jan 8, 2016.

  1. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,917
    Likes:
    1,098
    The Upload file dialog doesn't see a .JPG extension, but it does see a .jpg extension. My guess is uppercase versions of the permitted extensions need to be added. (Linux/Firefox)
     
  2. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,898
    Likes:
    502
    Location:
    Cleveland, OH, USA
    Works for me with uppercase extensions. Pilot error?

    Road kill.PNG vultures.JPG

    Capture.PNG

    John
     
  3. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,917
    Likes:
    1,098
    I'm using Linux which means a.out is a different file than A.out.

    The upper case JPG's dont show up as possibilities to load. Changed the case and they showed up. I'd EXPECT it to work under Windows.
     
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,029
    Likes:
    951
    Location:
    NJ

    Hello there,

    Yes Linux has case sensitive file names, and that is because Linux was written by people who knew programming much better than people who write Windows code. The stuff i have seen under Windows is mind boggling as to how inexperienced some of the writers must be.

    What i am suspecting now is that we see this same trend for forum software. I am not exactly sure what software it is, is it "Zenforo" maybe? It is obvious that the writers, at least at first, did not know how to handle file case. What is a little puzzling though is that under windows usually we compare filenames with either upper() or lower() or some version of that, so that filenames like MyFile.jpg would look the same as MyFile.JPG. This means both files would show up, but as the same file so there would not be a separate filename for both. That works in Windows.
    However, the file selection is often done with a file dialog that is written by the Windows op sys writers, we just call that up when the user wants to select a file. Under Windows it is called GetOpenFileName(), but again that would treat those two filenames as the same file and whats more is any file creation routine would not allow those two to be created in the first place.
    If this forum software is written under Java, then we have more stuff to consider such as is there a flaw in Java that does not allow distinguishing the two filenames apart from each other. If there is a common dialog box API for selecting a filename then the fault could be there. Whoever wrote it did not know much about Linux.
    It is possible to make a custom dialog box for just about anything, but of course it takes much more time to write because less is already done for you. GetOpenFileName() for example takes one parameter OPENFILENAME struct:

    typedef struct tagOFN { // ofn
    DWORD lStructSize;
    HWND hwndOwner;
    HINSTANCE hInstance;
    LPCTSTR lpstrFilter;
    LPTSTR lpstrCustomFilter;
    DWORD nMaxCustFilter;
    DWORD nFilterIndex;
    LPTSTR lpstrFile;
    DWORD nMaxFile;
    LPTSTR lpstrFileTitle;
    DWORD nMaxFileTitle;
    LPCTSTR lpstrInitialDir;
    LPCTSTR lpstrTitle;
    DWORD Flags;
    WORD nFileOffset;
    WORD nFileExtension;
    LPCTSTR lpstrDefExt;
    DWORD lCustData;
    LPOFNHOOKPROC lpfnHook;
    LPCTSTR lpTemplateName;
    } OPENFILENAME;

    On return the function fills some of the members of this struct so the caller knows what file the user has selected, if any.

    Someone would have to look into the software here and see what function they call and what options are available. For the above under Windows for example, you might force the user to look for files with only one type of extension rather than let them choose any file with any extension.

    I've done minimal programming under Linux myself so i cant recommend anything except that.
     
  6. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,898
    Likes:
    502
    Location:
    Cleveland, OH, USA
    The source of your problem appears to be your PC, not the Forum's software. I just demonstrated uploading two images with uppercase extensions. Those extensions showed when uploaded -- just look at the snippet of the upload window that I posted. Can you demonstrate uploading one image with lower case that won't upload with uppercase?

    Now when you say, "The upper case JPG's don't show up as possibilities to load," is this whole issue about the fact that you want to see a list of uppercase extensions when you upload, not whether they work the same as lowercase?

    John
     
  7. DerStrom8

    DerStrom8 Super Moderator Most Helpful Member

    Joined:
    Aug 9, 2010
    Messages:
    5,484
    Likes:
    503
    Location:
    Vermont (GMT-5:00)
    Are you running linux?
     
  8. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,898
    Likes:
    502
    Location:
    Cleveland, OH, USA
    I am not running Linux, but the problem, if there is one, seems to be Linux. This forum clearly accepts both uppercase and lowercase extensions and any combination thereof. Will expanding the visible list really be helpful to the vast majority of users?

    So far, the problem has just been claimed the uppercase extension is not SHOWN in the list. The OP has not shown that the uppercase extension won't upload.

    John
     
  9. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,029
    Likes:
    951
    Location:
    NJ
    Hi there John,

    I dont know if you realize it or not but you seem to be saying that since A and B things work and C does not work then it must be the fault of C. Ideally, we want all things to work, which includes C which in this case is Linux. If that is harder to get to work with the forum then that's just life and if the forum wants to allow Linux users the functionality that Linux provides users then it would have to be fixed.
    Granted this may not be as simple as we would like because the file system would then have to require allowing filenames with different case to be recognized as completely different files such as "MyFile.txt" and MyFile.TXT, and MyFile.Txt and MyFILE.txt, etc., which on Windows would be taken to be all the same file. This would create a problem for users that intend to download the four files as there would be a name collision on Windows where it would ask, "Filename X already exists, Overwrite (y/n)?" or something to that effect making it impossible to download all four files into the same directory, unless of course filename translation was provided that for example numbered the files 1,2,3,4, etc.
    This is more of a problem than some of the other stuff we have talked about on here, but sometimes a clever person can come up with a simpler idea and then it gets fixed :)

    I'd like to hear KISS's thoughts on this too.
     
  10. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,898
    Likes:
    502
    Location:
    Cleveland, OH, USA
    MrAl, Please stop putting words in my mouth and then saying the logic is wrong. That is a straw-man argument (https://en.wikipedia.org/wiki/Straw_man), which albeit can be effective in some circles, but that is not a valid way to constructively address a problem.

    Please re-read the underlined portions of what I said. Aside from using a straw man, can you provide any evidence that the so-called problem is with the forum and not with the user and/or that user's software?

    Note, I am not saying there is no problem. I am saying no evidence has been presented that graphics with uppercase extensions don't upload, i.e.,
    I can't see wasting time solving a "problem" that has not been demonstrated. In fact, I demonstrated two examples of graphics with uppercase extensions that uploaded and displayed just fine.

    John
     
  11. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,029
    Likes:
    951
    Location:
    NJ

    Hi John,

    Didnt you say that problem was with Linux and therefore implied it was not with Windows?

    Also, i assumed that the problem was because of the case sensitivity that exists under Linux but not under Windows. So i simply suggested that looking at the file open dialog in the forum software might help. That's because it sounds like the file open dialog can not recognize the difference between MyFile.txt and MyFile.TXT which would look the same under Windows. In other words, it only finds the first file but not the second. A guess would be that it looks for files chronologically, and if so, removing both files and then creating the second one first and the first one last would switch the order of the files and so the second one would show up only (provided the first one showed up to start with).
    Alternately, it may look alphabetically, or even reverse alphabetically, so it would find the lower case 't' before the upper case 'T' and therefore show that one first. Just guesses though.

    Drawing attention to your paragraph:
    But you have Windows, not Linux, that's the whole ball game. This means you can not successfully complete a valid test for this. You would have to have Linux installed or try a live version. I dont know if you realize that Linux has non-case-sensitive file names. This means you can have the two files MyFile and MYFILE in the same directory. Try that with Windows and it will not let you create the second file without overwriting the first. This in turn means that a File Open dialog box under Windows does not have to recognize case for filenames, whereas the dialog box under Linux would have to.

    You have proved one thing however: that JPG extensions work under Windows, but you have not proved that it works under Linux too.
     
    Last edited: Jan 9, 2016
    • Agree Agree x 1
  12. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,898
    Likes:
    502
    Location:
    Cleveland, OH, USA
    Never said that.

    How can that be? They appear differently on the forum (browser =Chrome). Can you post an example of your code that sees two things as exactly the same, but prints them differently? It might also help, if you posted the sections of Linux code responsible for this purported behavior.

    [/quote]But you have Windows, not Linux, that's the whole ball game. This means you can not successfully complete a valid test for this. [/quote]
    Then why don't you or KISS do that? We are at post#10, and no one has done that.

    So? Are you accepting that the so-called problem is with Linux?

    Absent anyone actually showing there is a problem, I can't see the value in this thread.

    John
     
  13. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,917
    Likes:
    1,098
    OK guys.

    1. Screenshot of a Linux directory containing A.JPG and a.jpg - They are both different files.
    a. try to do that in Windows.

    2. .Screenshot of the directory (using the Linux OS)
    a. Note: a file exists with a .jpg extension and a .JPG extension

    3. ETO Upload
    a. Note the same directory is selected as in #2
    b.Note that only a file with the lowercase .jpg shows up for possible upload.
    c. Note that only lowercase extensions are permitted.


    The browser is Firefox 43 and the OS is Linux 12.04 LTS which incidentally you can run from a DVD.

    The file system for 1,2 and 3 is on a NAS and probably ext4.

    On a Flash drive the files a.doc and a.DOC cannot exist simultaneously.
    On the flash drive .DOC and .doc can both be seen by ETO Upload, but the filesystem is not Linux native.

    So, yes, there is a little more than meets the eye.
     

    Attached Files:

  14. jpanhalt

    jpanhalt Well-Known Member Most Helpful Member

    Joined:
    Jun 21, 2006
    Messages:
    5,898
    Likes:
    502
    Location:
    Cleveland, OH, USA
    If I understand what you describe, the problem is the lack of case sensitivity for file extensions, not that forum software doesn't recognize uppercase JPG as being different from lowercase jpg. However, it does seem to allow one to upload the "same" file twice.
    Road kill.JPG

    Road kill.JPG

    So, I still don't see the problem so long as you can keep the two files separate in your mind.

    This previews fine. Let's see if it posts.

    Here's the snippet of the upload dialog:
    upload_2016-1-9_14-57-31.png

    John
     
  15. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,917
    Likes:
    1,098
    The file system that didn't recognize upper case extensions on uploads is NFS. Therefore it should not recognize .Jpg either.

    The files ystem that did recognize upper and lower case extensions was vFAT on a flash drive, That file system would not allow files named a.jpg and a.JPG to exist at the same time. Uppercase file name extensions were found during an ETO upload file dialog.

    My camera uses uppercase JPG extensions. So, when I copied a file to the NFS filesystem and edited it, upload would not find it. Changing the extension to lower-case made it work.

    The OS is Linux.
     
  16. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,029
    Likes:
    951
    Location:
    NJ
    It is very hard to talk to someone who either does not remember what they said two post ago or was trying to say something very different from what their post CLEARLY implies. Your first statement above implies that you believed the problem was with Linux, then you say you never said that. What ???


    KISS:
    Try making two files with the same base name but different case, see if that works. So for example:
    MyFile.txt
    MYFILE.txt

    See if those two work. If they do work then it is only with the file extensions, but if they dont work then it is a case problem with the ENTIRE name. Since Linux allows case sensitive names while Windows doesnt, i would expect the entire name to be a problem unless the software was case aware for the base name part and just not the extension, and we dont know for sure how the programmers did this until we do the test. There could be other catches too.
     
  17. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,917
    Likes:
    1,098
    Well .txt isn't supported.

    So they are named .hex

    Both uploaded fine.

    It's the *.hex That's lower case and it's taken literally. So, technically uppercase extensions are not supported, BUT it depends on the filesystem and OS or whatever software is creating the dialog boxes.
     

    Attached Files:

    Last edited: Jan 9, 2016
  18. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,029
    Likes:
    951
    Location:
    NJ
    Hi again,

    Wow, that's amazing. Then it's just the part that looks at file extensions, which sometimes gets input a list of allowed filename extensions. That's probably the forum software then. This list is usually decided upon by the programmer, who makes a list in a manner similar to this:
    List[]={ ".jpg", ".bmp", ."gif"}

    so a guess would be this has to be changed to:
    List[]={ ".jpg", ".bmp", ."gif", ".JPG", ".BMP", ."GIF"}

    before passing it in the call to the open file function.

    If it was Windows and Windows was case sensitive that's what would be required. Windows isnt case sensitive of course so when the Windows function call gets that first shorter list passed to it it will allow any case for the file extensions such as ".jpg", ".Jpg", ".JPG", etc.
    Under Windows this list would be passed as LPCTSTR lpstrFilter where lpstrFilter is the pointer to the list that allows only certain file extensions, and one of the Flags is set to not allow the user to select "All Files" in the dialog, which if allowed would enable the user to select any file of any type on the entire system even .exe files for example.
     
  19. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,917
    Likes:
    1,098
    Then devil's advocate comes along and says:

    What about ".Jpg" and "jPg and lpG"?

    It's not quite Linux. A vFAT file system under Linux works fine: a.jpg is the same as a .JPG and they can't co-exist.

    My camera spits out JPG's.
     
  20. MrAl

    MrAl Well-Known Member Most Helpful Member

    Joined:
    Sep 7, 2008
    Messages:
    11,029
    Likes:
    951
    Location:
    NJ
    Hi,

    But it only happens under Linux right? Never under Windows right?

    So the question is then does the forum software properly recognize the file system being used in Linux as one which supports case sensitive file names. Of course if the file system doesnt support case sensitivity it wont have a problem :)
     
  21. KeepItSimpleStupid

    KeepItSimpleStupid Well-Known Member Most Helpful Member

    Joined:
    Oct 30, 2010
    Messages:
    9,917
    Likes:
    1,098
    Probably. So, I just have to remember to change camera photos that I edit and upload to lower case extensions.

    There's probably a limit on the number of filters for the file dialog too.

    There's another gotcha in the upload dialog. It says you can upload up to 32 GB which you can't.
     

Share This Page