Dan Taipala
|
| Posted: 01/25/2005, 1:08 PM |
|
Does anyone know of an easy way to fix a file name uploaded to a linux server using the PHP file upload? The problem that I have is files uploaded from Windows clients to the Linux server may have characters that are not allowable in the linux file system. I want to be able to change the filename by removing all of the offending characters as part of the upload process. If the file gets uploaded to the temp directory with a 'bad' filename then it cannot be successfully manipulated because the copy command fails when trying to move it.
|
|
|
 |
klw
|
| Posted: 01/25/2005, 3:04 PM |
|
The regular expression string replacement can be used
to do what you need:
string ereg_replace ( string pattern, string replacement, string string)
Set 'pattern' to the regular expression needed to define
your offending characters?
Set 'replacement' to an empty-string - ''
Set 'string' to the name of the filename to be modified.
|
|
|
 |
Dan Taipala
|
| Posted: 01/25/2005, 3:39 PM |
|
The problem that I have isn't fixing the file name it is how can the filename be changed from one of the codecharge events. I tried to
change the file name in the beforeprocessfile event but the system then cannot move the file from the temp directory because it cannot find the right file. I tried to change it in the aferprocessfile event but the filename of the file in the directory doesn't match the filename loaded into the database.
Any ideas?
|
|
|
 |
matheus
Posts: 386
|
| Posted: 01/26/2005, 2:25 AM |
|
In Java I change the class FileUpload, and change the filename in a method.
_________________
Matheus Trevizan
Dynamix Software Ltda.
Blumenau SC Brasil
www.dynamix.com.br |
 |
 |