<<< Back to the TFU FAQ
FAQ 21: index for files vs. filename directly (New 2.15).
By default the file name and the index of a file is sent to the server. With $use_index_for_files you can decide which parameter to use.
- $use_index_for_files=true; - By using this way the index of a file is used. If e.g. the flash wants the preview of the 2nd image then index 1 is sent (index always starts as 0).
- $use_index_for_files=false; - For this setting the file name is directly used.
Comparision
- Index:
- Advantage: Works fine with any encoding.
- Disadvantage: When two users manipulate the directory listing at the same time e.g. a wrong file can be deleted because the oder user deleted it already.
- Filename:
- Advantage: No problems at parallel use.
- Disadvantage: Can have problems with encoding. Especially wich non ansi or utf-8 charsets!
If you want to use the file name directly the encoding of the server has to be set properly (see howto 10). Especially if you are working with not ansi characters. Otherwise the selected file is not found.
Which one should I use?
I have reworked the whole encoding and have not found any problem so far with ansi and utf-8 files. But other encodings are not tested. So if you don't have parallel users (means users that modify a directoy at the same time) stay with the index mode. This is the default for years now and I had never had a problem. The newer file name mode should be used if you expect parallel users and your encodings are set fine. Please make some tests with files with the special characters you expect.
I added the file name mode for a customer who had the requirement that many users come at the same day of a month at almost the same time and all use the same folder. And if someone has the same requirement as well he has now a safe solution.
The index mode is the default one because it runs on any server and is very stable.
Have fun using TFU.
|