Uploadmgr file extension issue

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Uploadmgr file extension issue

aecio
Hi everybody,

I'm using uploadmgr to upload files to the server. I need to filter the extension of the file to allow only word processors (.doc, .docx and .odt), slide show presentations (.ppt, .pptx and .odp), images (.jpg and .png) and PDF documents.

How can I do that???

Regards.
Reply | Threaded
Open this post in threaded view
|

Re: Uploadmgr file extension issue

John Spackman-3
I’m not sure that it’s possible to filter what the browser lets the user choose, but you could block the upload after the user has selected the file - when you get the “addFile” event, call preventDefault() if you do not want the file to be upload.

Note: I’ve only just made this mod a few minutes ago, so you’ll need to get the latest from the SVN repo at source forge

John


> On 13 Nov 2014, at 13:12, aecio <[hidden email]> wrote:
>
> Hi everybody,
>
> I'm using uploadmgr to upload files to the server. I need to filter the
> extension of the file to allow only word processors (.doc, .docx and .odt),
> slide show presentations (.ppt, .pptx and .odp), images (.jpg and .png) and
> PDF documents.
>
> How can I do that???
>
> Regards.
>
>
>
> --
> View this message in context: http://qooxdoo.678.n2.nabble.com/Uploadmgr-file-extension-issue-tp7586376.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Comprehensive Server Monitoring with Site24x7.
> Monitor 10 servers for $9/Month.
> Get alerted through email, SMS, voice calls or mobile push notifications.
> Take corrective actions from your mobile device.
> http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel



------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Uploadmgr file extension issue

marchomal
Hello,

Try to add this lines to the constructor of the class "com.zenesis.qx.upload.InputElement"

this.base(arguments, 'input', css, {
    type : 'file',
      name : name,
      title: ' ',
                        accept: ".png, .jpg"   // YOUR FILE EXTENSIONS HERE 
       });




construct: function(widget, multiple, name) {
        // styling the input[type=file]
        // element is a bit tricky. Some browsers just ignore the normal
        // css style input. Firefox is especially tricky in this regard.
        // since we are providing our one look via the underlying qooxdoo
        // button anyway, all we have todo is position the ff upload
        // button over the button element. This is tricky in itself
        // as the ff upload button consists of a text and a button element
        // which are not css accessible themselfes. So the best we can do,
        // is align to the top right corner of the upload widget and set its
        // font so large that it will cover even realy large underlying buttons.
        var css = {
              position  : "absolute", 
              cursor    : "pointer",
              hideFocus : "true",
              zIndex: widget.getZIndex() + 11,
              opacity: 0,
              // align to the top right hand corner
              top: '0px',
              right: '0px',
              // ff ignores the width setting pick a realy large font size to get
              // a huge button that covers the area of the upload button
              fontFamily: 'Arial',
              // from valums.com/ajax-upload: 4 persons reported this, the max values that worked for them were 243, 236, 236, 118
              fontSize: '118px'
        };
        if ((qx.core.Environment && qx.core.Environment.get('browser.name') == 'ie' && qx.core.Environment.get('browser.version') < 9 )
              || ( ! qx.core.Environment && qx.bom.client.Engine.MSHTML && qx.bom.client.Engine.VERSION < 9.0)) {
        css.filter = 'alpha(opacity=0)';
            css.width = '200%';
            css.height = '100%';
        }
        
this.base(arguments, 'input', css, {
    type : 'file',
      name : name,
      title: ' ',
accept: ".png, .jpg"   // YOUR FILE EXTENSIONS HERE 
       });
this.__widget = widget;
this.setMultiple(!!multiple);
},



Best regards.


2014-11-13 16:55 GMT+01:00 John Spackman <[hidden email]>:
I’m not sure that it’s possible to filter what the browser lets the user choose, but you could block the upload after the user has selected the file - when you get the “addFile” event, call preventDefault() if you do not want the file to be upload.

Note: I’ve only just made this mod a few minutes ago, so you’ll need to get the latest from the SVN repo at source forge

John


> On 13 Nov 2014, at 13:12, aecio <[hidden email]> wrote:
>
> Hi everybody,
>
> I'm using uploadmgr to upload files to the server. I need to filter the
> extension of the file to allow only word processors (.doc, .docx and .odt),
> slide show presentations (.ppt, .pptx and .odp), images (.jpg and .png) and
> PDF documents.
>
> How can I do that???
>
> Regards.
>
>
>
> --
> View this message in context: http://qooxdoo.678.n2.nabble.com/Uploadmgr-file-extension-issue-tp7586376.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
>
> ------------------------------------------------------------------------------
> Comprehensive Server Monitoring with Site24x7.
> Monitor 10 servers for $9/Month.
> Get alerted through email, SMS, voice calls or mobile push notifications.
> Take corrective actions from your mobile device.
> http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel



------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel