Uploaded filename length - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Uploaded filename length (/showthread.php?tid=7700) |
Uploaded filename length - El Forum - 04-19-2008 [eluser]Kemik[/eluser] Hello, A member of CI Base pointed out that they were having a problem downloading their code and deleting it. I discovered that the problem is the sql field length isn't long enough for their filename so I went to change it but they wondered, what if someone uploads something that's got a file name longer than 255 characters? My question is, how can I validate the length of a filename before uploading it? Is it just the same as any other input field? I cannot just do a max_length because the local file location could exceed the 255 characters while the filename itself doesn't. Any ideas? Thanks. Uploaded filename length - El Forum - 04-19-2008 [eluser]adamp1[/eluser] Why not just rename the zip file to use an id instead? Then you won't have the issue of having file names longer than 255 chars. Uploaded filename length - El Forum - 04-19-2008 [eluser]Kemik[/eluser] You mean encrypt_name? It would be a way that would work but then users who download several code don't know which is which. Is there anyway to rename the file before uploading? I could shorten the name and add a code_id to the end of the filename so there isn't clashes. Uploaded filename length - El Forum - 04-19-2008 [eluser]xwero[/eluser] You could rename the file with the id in your db for example and store the filename in a text type field and when downloaded you restore the user given name. Uploaded filename length - El Forum - 04-19-2008 [eluser]Alexandros Monastiriotis[/eluser] Hi I think you cannot validate the length of the filename in the client side, on a file type input tag. You may have already thought about this but why don't you alter the field to TEXT in the database table; Uploaded filename length - El Forum - 04-20-2008 [eluser]Kemik[/eluser] [quote author="Alexandros Monastiriotis" date="1208680396"]Hi I think you cannot validate the length of the filename in the client side, on a file type input tag. You may have already thought about this but why don't you alter the field to TEXT in the database table;[/quote] Because there's no point in storing really really long file names. I'm going to try and find a way to change the encrypted name to the filename submitted before the user downloads. |