CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 File Upload, Change File Name For Linux

Print topic Send  topic

Author Message
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
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.