what's the best way of checking the name of a file to ftp?
Posted: Mon Apr 07, 2003 8:55 am
Hi
I'm writing a bit of code to upload files by ftp - it works on most files but sometimes, if the file name has unacceptable characters, it just won't do it and i get an error message. As the users won't necessarily be very good with computers i'd like to find a foolproof way of sorting this out ...
what do i need to use to check if the file name contains characters that aren't 0-9, a-z (without accents) or 'underscore' ? I had one file that contained an apostrophe that uploaded ok but the filename was changed when it went into the database (a slash was added before the apostrophe) so it couldn't find the file afterwards to unlink it.
Then, is it possible to change the actual filename - replacing all the dodgy characters with an underscore, for example ? Or do i have to settle for putting up a message telling the user to change the filename?
thanks for any help
I'm writing a bit of code to upload files by ftp - it works on most files but sometimes, if the file name has unacceptable characters, it just won't do it and i get an error message. As the users won't necessarily be very good with computers i'd like to find a foolproof way of sorting this out ...
what do i need to use to check if the file name contains characters that aren't 0-9, a-z (without accents) or 'underscore' ? I had one file that contained an apostrophe that uploaded ok but the filename was changed when it went into the database (a slash was added before the apostrophe) so it couldn't find the file afterwards to unlink it.
Then, is it possible to change the actual filename - replacing all the dodgy characters with an underscore, for example ? Or do i have to settle for putting up a message telling the user to change the filename?
thanks for any help