Hi all,
What a great product is this XUploader (I've bought the pro version some time ago)
I have one problem, and that is that sometimes users upload files with a space or other weard character in the filename!
I'm using the upload script in combination of ImageMagick, and the problem is that IM does not like spaces or other weard stuff in the filenames (maybe this is a coding problem of one of my PHP pages)
Anyway... Till now I've been using a complicated way of renaming the files when needed with some extra PHP code, but is it maybe possible to do this within one of the XPuploader scripts?
Thank you.
Noel
XUpload - Takins spaces (and other weard characters) out of file name
- PilgrimX182
- Posts: 2186
- Joined: Mar 22, 2006 1:39 pm
Sure. Here goes quick hack:
in upload.cgi find this line:
and add after it:
in upload.cgi find this line:
Code: Select all
my ($fn,$ext) = ($1,$2);
Code: Select all
$fn=~s/\s/_/g;
Hello,
This is an awesome product.
I am experiencing the same problem. I need to specifically remove spaces and !@#$%^&* type characters from .mp3 files being uploaded.
I tried to use the hack but my upload.cgi file contains this line:
my ($fn,$ext) = $filename=~/^(.+)\.(.+)$/;
Not this one: my ($fn,$ext) = ($1,$2);
Can I still use the hack? If not can you show me exactly what to do?
Kind Regards,
Dante
This is an awesome product.
I am experiencing the same problem. I need to specifically remove spaces and !@#$%^&* type characters from .mp3 files being uploaded.
I tried to use the hack but my upload.cgi file contains this line:
my ($fn,$ext) = $filename=~/^(.+)\.(.+)$/;
Not this one: my ($fn,$ext) = ($1,$2);
Can I still use the hack? If not can you show me exactly what to do?
Kind Regards,
Dante
- PilgrimX182
- Posts: 2186
- Joined: Mar 22, 2006 1:39 pm
Hello,
First of all, Xupload is really a good soft, thanks.
I use Xupload Pro V3, I can't figure out how to :
1 - Replace space in the file name (with rename method in the configuration),
I've tried to change this line :
my ($fn,$ext) = $fhash->{file_name_orig}=~/^(.+)\.(.+)$/;
with my ($fn,$ext) = $fhash->{file_name_orig}=~s/\s/\_/g; but it seems it is not the good way.
2 - Replace french accentuated characters with the not accentuated one, it is possible ?
i.e : replace àèéç by aeec.
Thanks for helping
First of all, Xupload is really a good soft, thanks.
I use Xupload Pro V3, I can't figure out how to :
1 - Replace space in the file name (with rename method in the configuration),
I've tried to change this line :
my ($fn,$ext) = $fhash->{file_name_orig}=~/^(.+)\.(.+)$/;
with my ($fn,$ext) = $fhash->{file_name_orig}=~s/\s/\_/g; but it seems it is not the good way.
2 - Replace french accentuated characters with the not accentuated one, it is possible ?
i.e : replace àèéç by aeec.
Thanks for helping
PilgrimX182 could you help please, I'm sure it is possible.thuyet wrote:Hello,
First of all, Xupload is really a good soft, thanks.
I use Xupload Pro V3, I can't figure out how to :
1 - Replace space in the file name (with rename method in the configuration),
I've tried to change this line :
my ($fn,$ext) = $fhash->{file_name_orig}=~/^(.+)\.(.+)$/;
with my ($fn,$ext) = $fhash->{file_name_orig}=~s/\s/\_/g; but it seems to be this is not the good way.
2 - Replace french accentuated characters with the not accentuated one, it is possible ?
i.e : replace àèéç by aeec.
Thanks for helping
- PilgrimX182
- Posts: 2186
- Joined: Mar 22, 2006 1:39 pm
lol, nice try man
1)
Do next: after
add
- this will replace all spaces in filename with underscore.
2) Not sure this will work but you can try:
in same place as 1) add
and same for other 3 chars.
1)
Do next: after
Code: Select all
my ($fn,$ext) = $fhash->{file_name_orig}=~/^(.+)\.(.+)$/;
Code: Select all
$fn=~s/\s/\_/g;
2) Not sure this will work but you can try:
in same place as 1) add
Code: Select all
$fn=~s/à/a/g;
Thanks so much,
Nothing is impossible with Xupload, but ....
Ok for replacing spaces with underscore.
ut for accentuated letters, it works but upload time is much much more longer and it seems like it brings my server down.
Any idea ?
Nothing is impossible with Xupload, but ....
Ok for replacing spaces with underscore.
ut for accentuated letters, it works but upload time is much much more longer and it seems like it brings my server down.
Code: Select all
$fn=~s/à/a/g;
$fn=~s/é/e/g;
$fn=~s/è/e/g;
$fn=~s/ç/c/g;
- PilgrimX182
- Posts: 2186
- Joined: Mar 22, 2006 1:39 pm