jQuery UI Widgets Forums React Get Handle to File Object in jqxFileUpload Widget

This topic contains 3 replies, has 4 voices, and was last updated by  Martin 11 months, 1 week ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author

  • TT MM
    Participant

    Hi –
    Is it possible to get a handle to the File object, not simply the file name of the file, that is selected using the jqxFileUpload widget? When I console.log the event that gets to onSelect() and onUploadStart(), I can see the filename but not the File object. I would like to process the file before sending it up to the server. If it’s not possible, does jQWidgets have a widget that just allows me to grab the file and not send it up as part of the widget behavior? I would take care of sending it to the server on my own, after I’ve processed it. (where it says “< code >” below, it’s really the JavaScript template literal)

    Thanks,
    Tony

    ` …
    render() {
    return (
    <div>
    <JqxFileUpload
    ref={this.myFileUpload}
    width={this.state.width}
    accept={“.csv”}
    height={“100%”}
    theme={“energyblue”}
    onSelect={this.onSelect}
    uploadUrl={“chair”}
    fileInputName={“CHAIR088_2020-03-14_mod.csv”}
    onUploadStart={this.onUploadStart}
    localization={this.state.localization}
    />
    </div>
    );
    }

    private onSelect(event: any): void {
    this.myPanel.current!.append(
    ${event.args.file} ${event.args.size} <br/>
    );
    console.log(in onSelect());
    console.dir(event);
    }

    private onUploadStart(event: any): void {
    console.log(in onUploadStart());
    console.dir(event);
    this.myPanel.current!.append(${event.type} <br/>);
    }

    • This topic was modified 1 year, 6 months ago by  TT MM.
    • This topic was modified 1 year, 6 months ago by  TT MM.
    • This topic was modified 1 year, 6 months ago by  TT MM.
    • This topic was modified 1 year, 6 months ago by  TT MM.
    • This topic was modified 1 year, 6 months ago by  TT MM.

    Hristo
    Participant

    Hello Tony,

    Could you clarify what do you want to achieve?
    If you want to know more details about the file before the upload you could bind to the select event.
    Another option is to handle this on the Server-Side.
    I think this tutorial could be useful, you could look at the used approaches:
    https://www.jqwidgets.com/jquery-widgets-documentation/documentation/phpintegration/jquery-fileUpload-with-php.htm?search=

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com


    alexisdcarvajaln
    Participant

    what it is trying to say is that before sending the file to the server we could somehow manipulate it, that is, perhaps convert it into blob format and from there be able to send it to the server or identify if the file to upload is of type image and how much is the file size and weight.

    If that were possible it would help us a lot.


    Martin
    Participant

    Hello alexisdcarvajaln,

    Unfotunately, there is no such functionality.
    You can indentify the file type by checking its extension.
    You can check this in this Demo.

    Best Regards,
    Martin Yotov

    jQWidgets team
    https://www.jqwidgets.com

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.