Strategies For Naming Files For Download Via A Browser -


i working on site large number of (pdf) downloads. need come strategy naming these files.

so following main criteria:

  1. filenames need legal on operating systems.
  2. filenames need url safe.
  3. filenames need readable possible.

i've read around subject lot , read many conflicting opinions on characters can , can't used , strategies best.

what best set of rules apply naming files satisfy 3 criteria above.

i'm using rails 3 record.

i believe ascii character can escaped in url (i.e. %20 space).

the characters not allowed in windows \/:*?"<>| (according windows) , can't have files same names in different cases in same directory (i.e. file.txt , file.txt classify same name). linux , mac rather permitting. all operating systems or those? there quite few less-known operating systems well, they're not general-purpose usage.

so technically can limit space (0x20) ~ (0x7e) in the ascii table: (with exception of what's not allowable windows)

ascii

but in terms of readability , if don't want escape urls, it's easiest restrict 0-9, a-z , a-z , sort of separator (like _) nice have.

i found this table, should give pretty idea of needs escaped urls:

char    escape code space   %20 <       %3c >       %3e #       %23 %       %25 {       %7b }       %7d |       %7c \       %5c ^       %5e ~       %7e [       %5b ]       %5d `       %60 ;       %3b /       %2f ?       %3f :       %3a @       %40 =       %3d &       %26 $       %24 

Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

php - MySQLi multi_query results for later use -