SibSoft Ltd.
Development Services
software products
 RegisterRegister    SearchSearch   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
EZYWebhost - Cheap XUpload & XFileSharing 100% campatible hosting

AJAX upload progress bar

File sharing script
Upload with no extension

 
Post new topic   Reply to topic    SibSoft Ltd Forum Index -> XUpload
View previous topic :: View next topic  
Author Message
mtspecial



Joined: 08 Mar 2007
Posts: 14

PostPosted: Mar 12, 2007 4:09 pm    Post subject: Upload with no extension Reply with quote

Sometimes we have clients upload files with no extension (ie.. Font suitcae).

I've set the script to allow all extensions (.*), but if there is no extension, file_0. gets added to the beginning of the file.

exmaple:

user uploads a file called "Helvetica"
the file is uploaded and renamed to "file_0.Helvetica"

How do I stop this?
Back to top
View user's profile Send private message
PilgrimX182



Joined: 22 Mar 2006
Posts: 1107
Location: Undisclosed location

PostPosted: Mar 13, 2007 7:19 am    Post subject: Reply with quote

This is a bug. Next version will include this fix. Thank you!
Here goes quick fix: in upload.cgi replace
Code:
$filename=~ /(.+)\.(.+)/;

with
Code:
$filename=~ /(.+)\.?(.+)/;
Back to top
View user's profile Send private message Visit poster's website AIM Address
mtspecial



Joined: 08 Mar 2007
Posts: 14

PostPosted: Mar 13, 2007 12:15 pm    Post subject: Reply with quote

This change causes the script to place a "." before the last character in the file name.

Upload "filename" results in "filenam.e"
Back to top
View user's profile Send private message
mtspecial



Joined: 08 Mar 2007
Posts: 14

PostPosted: Mar 13, 2007 12:25 pm    Post subject: Reply with quote

I'm finding that it does this regardless if there is an extension or not.

upload "file.jpg" results in "file.jp.g"
Back to top
View user's profile Send private message
PilgrimX182



Joined: 22 Mar 2006
Posts: 1107
Location: Undisclosed location

PostPosted: Mar 13, 2007 1:29 pm    Post subject: Reply with quote

Oh, sorry. Haven't tested it well. Files without extension are pretty rare.
Here goes correct code for that string:
Code:

   $filename=~ /(.+)\.(.+)/;
   my ($fn,$ext) = ($1,$2);
   $fn=$filename unless $filename=~/\./;


also in upload.cgi replace 5 lines after "my $i;" to
Code:

   $ext=".$ext" if $ext;
   $i++ while (-e "$c->{target_dir}/$fn$i$ext" && $c->{copy_mode} eq 'Rename');

   $filename="$fn$i$ext";
   push @file_status, "OK. renamed to:$filename" if $i;
   &lmsg("MSG:File '$fn$ext' already exist!<br>New file saved as '$filename'.") if $i;
Back to top
View user's profile Send private message Visit poster's website AIM Address
mtspecial



Joined: 08 Mar 2007
Posts: 14

PostPosted: Mar 14, 2007 8:08 pm    Post subject: Reply with quote

Your newest code produces a different result...

upload "filename" results in "filename.filename"
Back to top
View user's profile Send private message
PilgrimX182



Joined: 22 Mar 2006
Posts: 1107
Location: Undisclosed location

PostPosted: Mar 15, 2007 7:52 am    Post subject: Reply with quote

Sent you fixed upload.cgi by email
Back to top
View user's profile Send private message Visit poster's website AIM Address
rodrigomf



Joined: 14 May 2008
Posts: 2

PostPosted: Jul 01, 2008 8:42 pm    Post subject: Can you post the solution? Reply with quote

Hi, I am having the same problem with some Mac users (I don't know why they use extensionless files).

Can you post the solution?

Thanx a lot!
Back to top
View user's profile Send private message
PilgrimX182



Joined: 22 Mar 2006
Posts: 1107
Location: Undisclosed location

PostPosted: Jul 02, 2008 6:34 am    Post subject: Reply with quote

Latest XUpload Pro support files without extension.
Back to top
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:   
Post new topic   Reply to topic    SibSoft Ltd Forum Index -> XUpload All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group