Disallowed types file - codeigniter

It's easy to set the allowed file in code igniter when we want to upload file if the amount is less. But if there are almost extension file I want to set as allowed types of file that can be uploade except file extension of .exe, how the easiest way to set the code ? besides I have to type all of type code in allowed_types configuration. ..

Related

For the use of the LocalizedResourceName property

I wish to customize my own folder style, I tried to make the folder get remarks by modifying the LocalizedResourceName property in desktop.ini.
I try to set LocalizedResourceName to a Chinese string. But it is displayed as garbled characters when it is actually displayed.
I noticed the following code in the desktop.ini of the system folder:
LocalizedResourceName=#%SystemRoot%\system32\shell32.dll,-21798
So I try to write a .dll file by myself, encapsulate the icon and string, and use it.
I already know how to make a resource-only dll file, but I don't know how to get a certain resource in the file. (ie, get the number -21798 in the above example code)
How should I do ?
By convention, a positive resource number is an index (0 is the first resource etc.) and negative numbers are resource ids. In this specific case, it is the string resource with the id of abs(-21798) that Windows would pass to LoadString.
If you want to create your own .dll, add a string with an id of 2 for example (any number between 2 and 0xffff) and in your .ini you would use #c:\path\mydll.dll,-2.
Before you go to all this trouble, just try saving the .ini as UTF-16 LE (Unicode in Notepad) and use Chinese strings directly without the #.

Reading a static file in C++ within the code

I have a code which will read the xml file using pugi xml. Given below is the content of the same.
xml_document doc;
xml_parse_result result = doc.load_file(sXMLFilePath.c_str());
Here sXMLFilePath is the file present in my system. I want to hard-code this file into the code itself. I dont want to read this file from the machine. Meaning I want to make this file static.
Also if the file size is more than 30MB, can I compress the same?

NiFi: Routing on File Types, e.g. csv, tsv, xlsx

I have a connected SFTP server, and I am trying to route files based on type: .csv, .tsv, and .xlsx. For now, I'm just uploading test files through the command line.
My flow is:
GetSFTP (with correct hostname, etc.) ->
RouteOnAttribute ->
LogAttribute (will dump elsewhere soon, this is just for testing)
My problem, I think, is that I created a property in RouteOnAttribute incorrectly:
Am I correct in assuming that this does not actually pick up on the .csv because it is not technically part of the filename? What would be the correct expression to route on the file type? Thanks!
You need some information that will tell you the type of file.
GetSFTP should be getting the filename from the file on the sftp server, so if those have the appropriate extensions then I would expect your RouteOnAttribute to work correctly.
If the filename does not have the appropriate extension, then the only thing you can do is try to use IdentifyMimeType to determine what type of file it is, and then route on the mime.type attribute.

Rules for file extensions?

Are there any rules for file extensions? For example, I wrote some code which reads and writes a byte pattern that is only understood by that specific programm. I'm assuming my anti virus programm won't be too happy if I give it the name "pleasetrustme.exe"... Is it gerally allowed to use those extensions? And what about the lesser known ones, like ".arw"?
You can use any file extension you want (or none at all). Using standard extensions that reflect the actual type of the file just makes things more convenient. On Windows, file extensions control stuff like how the files are displayed in Windows Explorer and what happens when you double click on it.
I wrote some code which reads and writes a byte pattern that is only
understood by that specific programm.
A file extension is only an indication of what type of data will be inside, never a guarantee that certain data formatted in a specific way will be inside the file.
For your own specific data structure it is of course always best to choose an extension that is not already in use for other file formats (or use a general extension like .dat or .bin maybe). This also has the advantage of being able to use an own icon without it being overwritten by other software using the same extension - or the other way around.
But maybe even more important when creating a custom (binary?) file format, is to provide a magic number as the first bytes of that file, maybe followed by a file header structure containing a version number etc. That way your own software can first check the header data to make sure it's the right type and version (for example: anyone could rename any file type to your extension, so your program needs to have a way to do some checks inside the file before reading the remaining data).

Is it wrong to put all Codeigniter translations into one translation file

Looking fro some advise...
I'm creating a multi-language site with Codeigniter. CI allows me to create several language files, e.g. one per controller and load language files whenever I need them.
For me it sounds easier to just work with one language file and auto-load it, but this approach doesn't seem to be encouraged. Can anyone tell me if working with one language file (per language) is OK, or should I use a language file per controller ?
It depends on the size of your file, if size of your single file is too big then for every time you load the file all data for that file will get loaded and your script will take much more memory, in case of big language file it is always to use multiple files and load it when needed, and if your language file is small it is always better to use single file so that you don't need to manage it and simple to use.

Resources