FILE TYPES, FIX CASE SENSITIVITY doc DOC DOc Doc dOc dOC doC

neil3834

New Member
YetiShare User
Apr 10, 2014
57
0
0
List of document archive labels.TXT 1.01 KB Error: File type not allowed
WHY on earth is .txt permitted but .TXT is not?
Some applications save in uppercase, and MAC OS applications also save in uppercase a lot of the time.

This is just useless. I now have to add ALL extensions as:
*.txt;*.Txt;*.tXt;*.txT;*.TXt;*.TxT;*.tXT;*.TXT

That is just for a text document!

Could you please add an option to "make permitted file type inclusions case insensitive.".

Thanks
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
Re: FILE TYPE is NOT Case Insensitive!

It IS case insensitive. Just tried on our dev site.
 

neil3834

New Member
YetiShare User
Apr 10, 2014
57
0
0
No. I've just tried it again.

Linux operating systems treat files "Example.doc"and "example.doc" as two different files.
Windows treats them as the same file.

I do this for a living. I've added .TXT; and others to the list of extensions... only way to get it to work.
 

neil3834

New Member
YetiShare User
Apr 10, 2014
57
0
0
files:

IMG_2014030549967.png 0.00

0.00 KB Error: File type not allowed
Blocks Screensaver1.PNG 0.00 KB

add file


I'm on my phone now, not my notebook or desktop. I selected the first file. No error. Selected another file. No error. Selected...Selected...Selected, and then final found an image with uppercase extension, and it displayed an ERROR.

So it isn't my browser, isn't my computer. It is clearly the script.

You may not be aware, Windows is case insensitive, you can't create Example.doc and example.doc in the same directory. But on Linux, you can create Example.doc, EXAMPLE.doc, example.doc and even eXample.doc and they would not complain that the file already exists.

I can guarantee you that there is a problem. I would not waste my time writing detailed reports of issues and problems
 

neil3834

New Member
YetiShare User
Apr 10, 2014
57
0
0
Re: FILE TYPE is NOT Case Insensitive!

Hello Adam,

Do you have any recommendation on a file I can edit to fix this?
There appear to be a few obvious bugs in this script, stumbled over by simply performing configuration and uploading various document types. I really hope they can be fixed.

DOCUMENTS 10
.doc;.docx;.txt;.xls;.xlsx;.csv;.ppt;.pptx;.pdf;.xps;
GRAPHICS 15
.jpg;.jpeg;.gif;.png;.tiff;.bmp;.dxf;.svg;.psd;.ai;.eps;.pages;.ps;.ttf;.otf;
MULTIMEDIA 18
.mp3;.aac;.m4a;.f4a;.oga;.ogg;.ogv;.mp4;.m4v;.f4v;.mov;.webm;.flv;.mpeg;.avi;.wmv;.divx;.qt;
ARCHIVES 7
.zip;.7z;.rar;.tar;.tgz;.gz;.bz;
OTHER 2
.sql;.db;
 

neil3834

New Member
YetiShare User
Apr 10, 2014
57
0
0
FILE TYPES, CASE SENSITIVE FIX - PHP Script To Solve Issue

SOLUTION

Steps:
- Create a blank file.
- Rename it to "yetiext.php"
- Open it in Notepad++ or a text editor.
- Paste in the contents from below.
- Upload to your server and run: http://your-domain.com/yetiext.php?ext=example

Enter each of your extensions (doc, docx, docm, dot, dotx, dotm, txt, rtf, pdf, csv ....)
:)

PHP CODE
Code:
<?php
/* ####################################################### *
 *                           Neil's Permutations Builder!  *
 *                                    v1.0.1 | 2014.05.04  *
 *         (c) 2014 Neil [neil3834]. All rights reserved.  *
 *          Original Project: http://forum.mfscripts.com/  *
 *                                                         *
 * EXAmple,exaMple,ExaMple,eXaMple,EXaMple,exAMple,ExAMple *
 *                                                         *
 * Created to bulk generate all possible file extension    *
 * combinations, patterns and permutations in both upper   *
 * and lower case. The patterns  may be added to Yetishare *
 * to restrict permitted file uploads.                     *
 *                     This can be used for anything! :D   *
 * ####################################################### */

function nEiL($word) {
	if (!$word)
		return array($word); // If blank, return.

	$permutations = array(); // Build Array

	foreach (nEiL(substr($word, 1)) as $permutation) { // Loop
		$lower = strtolower($word[0]);
		$permutations[] = $lower . $permutation;

		$upper = strtoupper($word[0]);
		if ($upper !== $lower)
			$permutations[] = $upper . $permutation;
	}
	return $permutations; // Return All Possible Combinations of Characters Upper/Lower.
}

$array = nEiL($_GET['ext']); // Get Text To Process.

foreach ($array as $string) { // Loop
	echo "." . $string . ";"; // Extension Output Here.
}
?>
 

neil3834

New Member
YetiShare User
Apr 10, 2014
57
0
0
FILE TYPES, CASE SENSITIVE FIX! pdf pdF pDf pDF Pdf PdF

"And for something I prepared earlier..." :p

Here are the extensions I use - it means that people are less likely to run into trouble attempting to upload files. Especially when batch uploading 20 - 50, and not noticing a few of them fail. The benefit is that if a xxxx.psd is saved as .PSD, it can still be uploaded by Yetishare without error. The same applies for .Psd, .PSd, .pSD, ....

I hope this saves your fingers from a lot of repetitive work, and problems where clients cannot upload files to your server! :D Most of the formats listed for the MS Office documents are supported by the Yetishare Document Viewer (except for the less common file types).



MS WORD - DOCUMENTS (inc OpenOffice-like extensions etc)
.doc;.doC;.dOc;.dOC;.Doc;.DoC;.DOc;.DOC;
.docx;.docX;.doCx;.doCX;.dOcx;.dOcX;.dOCx;.dOCX;.Docx;.DocX;.DoCx;.DoCX;.DOcx;.DOcX;.DOCx;.DOCX;
.docm;.Docm;.dOcm;.DOcm;.doCm;.DoCm;.dOCm;.DOCm;.docM;.DocM;.dOcM;.DOcM;.doCM;.DoCM;.dOCM;.DOCM;
.dot;.Dot;.dOt;.DOt;.doT;.DoT;.dOT;.DOT;
.dotm;.Dotm;.dOtm;.DOtm;.doTm;.DoTm;.dOTm;.DOTm;.dotM;.DotM;.dOtM;.DOtM;.doTM;.DoTM;.dOTM;.DOTM;
.dotx;.Dotx;.dOtx;.DOtx;.doTx;.DoTx;.dOTx;.DOTx;.dotX;.DotX;.dOtX;.DOtX;.doTX;.DoTX;.dOTX;.DOTX;
.txt;.txT;.tXt;.tXT;.Txt;.TxT;.TXt;.TXT;
.rtf;.Rtf;.rTf;.RTf;.rtF;.RtF;.rTF;.RTF;
.pdf;.pdF;.pDf;.pDF;.Pdf;.PdF;.PDf;.PDF;
.xps;.xpS;.xPs;.xPS;.Xps;.XpS;.XPs;.XPS;
.wps;.Wps;.wPs;.WPs;.wpS;.WpS;.wPS;.WPS;
.wpt;.Wpt;.wPt;.WPt;.wpT;.WpT;.wPT;.WPT;
.odt;.Odt;.oDt;.ODt;.odT;.OdT;.oDT;.ODT;


MS EXCEL - SPREADSHEETS (inc OpenOffice-like extensions etc)
.xls;.xlS;.xL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4V;.F4v;.F4V;.F4v;.F4V;
.mov;.moV;.mOv;.mOV;.Mov;.MoV;.MOv;.MOV;
.webm;.webM;.weBm;.weBM;.wEbm;.wEbM;.wEBm;.wEBM;.Webm;.WebM;.WeBm;.WeBM;.WEbm;.WEbM;.WEBm;.WEBM;
.flv;.Flv;.fLv;.FLv;.flV;.FlV;.fLV;.FLV;
.mpeg;.Mpeg;.mPeg;.MPeg;.mpEg;.MpEg;.mPEg;.MPEg;.mpeG;.MpeG;.mPeG;.MPeG;.mpEG;.MpEG;.mPEG;.MPEG;
.avi;.Avi;.aVi;.AVi;.avI;.AvI;.aVI;.AVI;
.wmv;.Wmv;.wMv;.WMv;.wmV;.WmV;.wMV;.WMV;
.divx;.Divx;.dIvx;.DIvx;.diVx;.DiVx;.dIVx;.DIVx;.divX;.DivX;.dIvX;.DIvX;.diVX;.DiVX;.dIVX;.DIVX;
.qt;.Qt;.qT;.QT;


FILE ARCHIVES
.zip;.Zip;.zIp;.ZIp;.ziP;.ZiP;.zIP;.ZIP;
.7z;.7Z;
.rar;.Rar;.rAr;.RAr;.raR;.RaR;.rAR;.RAR;
.tar;.Tar;.tAr;.TAr;.taR;.TaR;.tAR;.TAR;
.tgz;.Tgz;.tGz;.TGz;.tgZ;.TgZ;.tGZ;.TGZ;
.gz;.Gz;.gZ;.GZ;
.bz;.Bz;.bZ;.BZ;


OTHER FILE FORMATS
.sql;.Sql;.sQl;.SQl;.sqL;.SqL;.sQL;.SQL;
.db;.Db;.dB;.DB;
.xml;.Xml;.xMl;.XMl;.xmL;.XmL;.xML;.XML;
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
Re: FILE TYPES, FIX CASE SENSITIVITY doc DOC DOc Doc dOc dOC

neil3834 said:
files:

IMG_2014030549967.png 0.00

0.00 KB Error: File type not allowed
Blocks Screensaver1.PNG 0.00 KB

add file


I'm on my phone now, not my notebook or desktop. I selected the first file. No error. Selected another file. No error. Selected...Selected...Selected, and then final found an image with uppercase extension, and it displayed an ERROR.

So it isn't my browser, isn't my computer. It is clearly the script.

You may not be aware, Windows is case insensitive, you can't create Example.doc and example.doc in the same directory. But on Linux, you can create Example.doc, EXAMPLE.doc, example.doc and even eXample.doc and they would not complain that the file already exists.

I can guarantee you that there is a problem. I would not waste my time writing detailed reports of issues and problems
I'd be interested in fixing this one but I need to replicate it first. I can't replicate it in Windows 7 on IE, FF or Chrome. Could you tell me what you used (on desktop) and I'll try again?
 

neil3834

New Member
YetiShare User
Apr 10, 2014
57
0
0
Re: FILE TYPES, FIX CASE SENSITIVITY doc DOC DOc Doc dOc dOC

Hey Adam,
The server is where this setting is configured. Windows servers (from my 15 years experience) tend to default to being configured to be non-case-sensitive (case-insensitive). Linux servers (from my 13 years experience) default to being configured to be case-sensitive.
So it is the server, not the browser nor the web client. Does that make sense?

When using a mobile web browser, and uploading (for example):
doc, xls, png, jpg, and then PNG, ZIP, it reports TWO error messages "File type not allowed". The other files are uploaded fine. The PNG and ZIP are not.

So to summarise:
- Linux web hosting (WHM/CPANEL)
- PHP 5.3.28
- Apache 2.2.26
- MySQL 5.1.72-cll-lve
- Perl 5.10.1

Windows Browsers:
- Firefox version twenty something. << File Extension Error.
- Chrome version thirty something. << File Extension Error.

Mobile Browsers:
- Boat Browser << 0.00KB And File Extension Error.
- Opera << 0.00KB And File Extension Error.

The above quote is from the MOBILE device. (i.e. 0.00KB).

I can upload some more files now if you like.
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
Re: FILE TYPES, FIX CASE SENSITIVITY doc DOC DOc Doc dOc dOC

Yes the extension error first. So the error is before you click upload though? I.e. just when you attach the file. Or a response from the server after attempting the upload?
 

neil3834

New Member
YetiShare User
Apr 10, 2014
57
0
0
Re: FILE TYPES, FIX CASE SENSITIVITY doc DOC DOc Doc dOc dOC

Was when attaching the file.
 

adam

Administrator
Staff member
Dec 5, 2009
2,046
108
63
Re: FILE TYPES, FIX CASE SENSITIVITY doc DOC DOc Doc dOc dOC

neil3834 said:
Was when attaching the file.
Ok so it's nothing to do with the server as it doesn't get that far. This is checked via Javascript. On our dev copy the line which allows for certain file types is:

Code:
acceptFileTypes: /(\.|\/)(doc|gif|jpg|png)$/i
Could you load your page in a browser then copy and paste this line also. Look for 'acceptFileTypes' in the rendered browser source code. The bit I'm interested in is the /i at the end as this makes it case insensitive.

http://stackoverflow.com/questions/5744582/how-to-make-regex-case-insensitive
 

neil3834

New Member
YetiShare User
Apr 10, 2014
57
0
0
Re: FILE TYPES, FIX CASE SENSITIVITY doc DOC DOc Doc dOc dOC

adam said:
Yes the extension error first. So the error is before you click upload though? I.e. just when you attach the file. Or a response from the server after attempting the upload?
I don't remember. You should be able to diagnose it by using normal linux-based web hosting. If you need 1GB to test, let me know!

Does this not narrow it down for you? Can you find this in the code and determine at what stage? (i.e. 6 files uploaded, 2 failed? Looks like once submitted to the queue and processed!) .... I have provided ample information to allow you to track down this issue:
When using a mobile web browser, and uploading (for example):
doc, xls, png, jpg, and then PNG, ZIP, it reports TWO error messages "File type not allowed". The other files are uploaded fine. The PNG and ZIP are not.
DOC permitted extension needs to preg match against: doc, doC, dOc, dOC, Doc, DoC, DOc, DOC. As Doc == DOC or xXx == XxX == XXX.
DOC = 3 char. So 3 x 3 - 1 = 8 possibilities.
DOCX = 4 char. So 4 x 4 - 1 = 15 possibilities.

It would of course be much easier if the case sensitivity issue was resolved, rather than having to manually add 8 to 15 possibilities (or at least 3 [xxx, Xxx, XXX] for each extension) for each permitted extension...

SOLUTION: Slap lower(); or upper(); around all your code that splits the extension and checks it, to make it ignore the case!