1. #1
    Ext User
    Join Date
    Oct 2008
    Posts
    104
    Vote Rating
    0
    nokia786 is on a distinguished road

      0  

    Default echo back uploaded file into a textarea

    echo back uploaded file into a textarea


    I am trying to provide a file upload form to the user with the standard inputType as 'file'.

    The goal is to let the user see the uploaded contents back in a TextArea so that he can further edit the content.

    I have written a PHP that does the below:

    Code:
    <?php
    
        if (is_uploaded_file($_FILES['tpFile']['tmp_name']))
            $fileData = file_get_contents($_FILES['tpFile']['tmp_name']);
        echo '{success:true, file:\''. $fileData . '\'}';;
    ?>
    The client side submits and receives like the below:

    Code:
                    
                       if(fp.getForm().isValid()){
                        fp.getForm().submit({
                            url: '/echoupload.php',
                            waitMsg: 'Uploading your data file...',
                            success: function(fp, o){
                                theTextArea.setRawValue(o.result.file);
                                
                            },failure: function(fp, o){
                                theTextArea.setRawValue(o.result.file);
                                
                            }
                        });
    There are two problems:

    1. This is not working in FireFox (FireBug shows an empty string for o.result.file.

    2. It is working in IE but the new lines are stripped off and all content is displayed in one line.

    Is there a standard approach to do this that I am over-engineering? The uploaded file can have data including special characters, new lines etc.

  2. #2
    Sencha User robertlight's Avatar
    Join Date
    Nov 2009
    Location
    Boston area
    Posts
    19
    Vote Rating
    0
    robertlight is on a distinguished road

      0  

    Default Did you ever solve this?

    Did you ever solve this?


    I am trying to do the very same thing... did you ever solve this problem?

    Many thanks if you could post the solution!!

    - Bob

Thread Participants: 1

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar