1

Topic: Trouble with filename and hanging upload box

After having lots and lots of difficulties getting the imagemanager to run descent, I ran into the following problems that seem inpossible to fix.

1) I get the error "filename is invalid" all the time. If I have spaces in it for example, it'll fail. I know, spaces aint nice to have in your filename, but all my clients will. It could rename all the spaces to underscores or something. But where to start? I'm lost after debugging hours and hours. It looks like a basic functionality to me.

2) The screen with the two buttons only (to upload).    Like        [ Browse ] [ Upload]       , so without text-boxes fail a lot of the time. They'll upload, but when they're finished, nothing will happen and the screen just sort of freezes!

Anyone know how to fix this problems? I can give code as requested.

Last edited by RdeWilde (2007-06-28 10:45:47)

2

Re: Trouble with filename and hanging upload box

Oh really what kinds of problems, good to know for future reference? Since the idea and how it works on our test servers is a simple 1 minute installation but some environments are configured in a non standard way and we have tried to think of all of them. smile

1) Try disabling the flash uploaded. It might be an encoding problem in Flash with files and spaces use upload.use_flash=false.
2) Same here disable the flash upload thing. I have been saying that a lot these days and that piece of the app will be gone for 3.0.3 you make be sure of that. smile

Best regards,
Spocke - Main developer of TinyMCE

3

Re: Trouble with filename and hanging upload box

The setting use_flash is already configured false. It won't help.

I had a lot of difficulties with getting access and permissions. These worked their way in a lot of process. The main fix was to allow everyone and everywhere. Don't know if that's supposed to be named a fix.

Anyway, is there a way to allow spaces or write my own code to replace the characters (where to place the code?)

4

Re: Trouble with filename and hanging upload box

You could just set the NETWORK_SERVICE user to have modify access to the files. I will look into why spaces can't be used when uploading. Does it work with files without spaces?

Best regards,
Spocke - Main developer of TinyMCE

5

Re: Trouble with filename and hanging upload box

I have the same problem with spaces in filenames as RdeWilde here. I have flash upload disabled and version 3.0.2

The uploader is complaining about "Filename is Invalid" when I try to upload filnes with spaces in the filename.
I is easy to remove spaces in the filename by hand but it shouldn't be necessary. It should be removed automatically. My customers get all freaked out whenever they see a error screen and doesn't care to find out what they need to do.

I hope you could have a look at this for future versions and point me to the js file that handles filename uploads so I may try a fix myself.

Joakim
www.gum.no

"Also note that it is your responsibility to die() if necessary"
- php.net

6

Re: Trouble with filename and hanging upload box

Try changing the filesystem.exclude_file_pattern to '' to see if that has any effect. We will look in to this problem for the next version.

Best regards,
Spocke - Main developer of TinyMCE

7

Re: Trouble with filename and hanging upload box

That seemed to do the trick. But still. This is allowing spaces in filenames on the server! Thats breaking a golden rule in server filesystems isn't it? It works in my browser but it could result in some strange urls like /my%20picture.jpg that may be bad for some scripts.

So instead I made a hack in /pages/im/js/upload_dialog.js after line #288 that changes all spaces to underscores before upload

=====Add=====
var oldp = '';
while(p != oldp){
    oldp = p;
    p = p.replace(/\s+/, '_');
}
============

=== Complete =====
        onUploadChangeFile : function(e) {
            var f = e.form, p;

            p = '' + e.value.replace(/\\/g, '/');
            p = p.substring(p.lastIndexOf('/') + 1);
            p = p.substring(0, p.lastIndexOf('.'));
            var oldp = '';
            while(p != oldp){
                oldp = p;
                p = p.replace(/\s+/, '_');
            }
            f.name0.value = p;
        },
=============

Hope this helps someone!

Joakim
www.gum.no

"Also note that it is your responsibility to die() if necessary"
- php.net

8

Re: Trouble with filename and hanging upload box

Just remember to clear you cache after implementing it...

"Also note that it is your responsibility to die() if necessary"
- php.net

9

Re: Trouble with filename and hanging upload box

Yes that is smart. The older versions had a similar replacement method it also replaced national characters like åäö with aao etc. We will think of a better method of configuring these replacements on uploads for future versions.

Best regards,
Spocke - Main developer of TinyMCE

10

Re: Trouble with filename and hanging upload box

Here is an updated and complete version of my script:
This one is handling norwegian characters specialy and replaces all other characters than a-z A-Z 0-9 and _

===========
            var oldp = '';
            while(p != oldp){
                oldp = p;
                p = p.replace(/\u00E6+/, 'ea'); // æ
                p = p.replace(/\u00F8+/, 'oe'); // ø
                p = p.replace(/\u00E5+/, 'aa'); // å
                p = p.replace(/\u00C6+/, 'Ea'); // Æ
                p = p.replace(/\u00D8+/, 'Oe'); // Ø
                p = p.replace(/\u00C5+/, 'Aa'); // Å               
            }
            oldp = '';
            while(p != oldp){
                oldp = p;
                p = p.replace(/\W+/, '_'); // All other characters than a-zA-Z0-9_ is replaced with _
            }
========

Enjoy!

"Also note that it is your responsibility to die() if necessary"
- php.net