1. #51
    Sencha User
    Join Date
    Sep 2007
    Posts
    11
    Vote Rating
    0
    southside is on a distinguished road

      0  

    Default

    Thanks MaximGB I will have a look, sorry if this is elementary but I am just finding my way and appreciate the help.

  2. #52
    Sencha User
    Join Date
    Sep 2007
    Posts
    11
    Vote Rating
    0
    southside is on a distinguished road

      0  

    Default

    [QUOTE=MaximGB;65415]The upload-dialog-request.php isn't missing , the code of upload-dialog-request.php which I use in the demo is following:
    [code]

  3. #53
    Sencha Premium Member MaximGB's Avatar
    Join Date
    Jun 2007
    Location
    Moscow, Russia
    Posts
    510
    Vote Rating
    5
    MaximGB is on a distinguished road

      0  

    Default

    Quote Originally Posted by southside View Post
    Hi Maxim;
    Hi southside

    Quote Originally Posted by southside View Post
    Do you have a zip of full project to assist in my learning curve, I am new to this and eager to learn.
    Yes I do , now it contains 1391 files in 258 folders, and I guess it won't help you.

    Quote Originally Posted by southside View Post
    I know some are sensitive about being asked to supply their hard work so if this applies to you then let me know and I will trudge along through the forum until I can pull together a working example that I can build on.
    No I am not such a sensitive, but I don't understand you request, if you need examples use extjs's examples that go with distribution. If you have questions ask them here or at other forums devoted to those technologies you have questions in.

    Quote Originally Posted by southside View Post
    Starting from a blank sheet may be to steep for me at this time. Thanks for your help. SC
    "This is the talk for the poor peoples sake". If you have questions for which you can't find answers in the docs, books, net, then you should ask those questions.
    Use the force - read the source.

  4. #54
    Sencha User
    Join Date
    Sep 2007
    Posts
    11
    Vote Rating
    0
    southside is on a distinguished road

      0  

    Default

    Hi Maxim;

    I have managed to get the files saving to my server location using your upload system.

    I see threads about a response cannot be sent back from a php upload page.

    Your code below is in a php page and sends an OK back to the dialog I assume.

    I have tried to do the same in my php page and had no message returned to the dialog.

    If I use your code in your upload-dialog-request.php I get the OK.

    So my JSON I guess is running fine - my server is PHP 4.3.9 with json 1.2.1.

    Can you help, I just need to know how to tell my php page to send th OK on success?

    I thought I could just use the

  5. #55
    Sencha Premium Member MaximGB's Avatar
    Join Date
    Jun 2007
    Location
    Moscow, Russia
    Posts
    510
    Vote Rating
    5
    MaximGB is on a distinguished road

      0  

    Default

    You should return a json-message in following format:
    Code:
    {
      success: true of false,
      error: 'String with error or message, with member also can be named message',
      ...
      any other your code private data
      ...
    }
    There is only one required member in this message, it's 'success' flag.
    Using php the message creation code should be like this:
    Code:
    $response = array();
    if ($file_uploaded) {
       $response['success'] = true;
       $response['message'] = 'File uploaded successfully';
    else {
       $response['success'] = false;
       $response['message'] = 'Some error occurred during file upload';
    }
    echo json_encode($response);
    I advise you to install Firefox with Firebug plugin (if you still haven't done it) and see what json-message your code is actualy returning.
    Use the force - read the source.

  6. #56
    Sencha User
    Join Date
    Sep 2007
    Posts
    11
    Vote Rating
    0
    southside is on a distinguished road

      0  

    Default

    Quote Originally Posted by MaximGB View Post
    You should return a json-message in following format:
    Code:
    {
      success: true of false,
      error: 'String with error or message, with member also can be named message',
      ...
      any other your code private data
      ...
    }
    There is only one required member in this message, it's 'success' flag.
    Using php the message creation code should be like this:
    Code:
    $response = array();
    if ($file_uploaded) {
       $response['success'] = true;
       $response['message'] = 'File uploaded successfully';
    else {
       $response['success'] = false;
       $response['message'] = 'Some error occurred during file upload';
    }
    echo json_encode($response);
    I advise you to install Firefox with Firebug plugin (if you still haven't done it) and see what json-message your code is actualy returning.
    Maxim;

    I think I see, I am a bit unsure though.

    Say I am using the basic php upload file like below, this uploads the file but i obviously get no response back via json. (Ps I am using firebug to watch for response from your dialog upload utility).

    When I try and enter the response code into the php upload your dialog upload returns an error and does not upload the file eg I get a red cross.

    So I guess i am doing it wrong can you advise how the response should be placed in the simple php upload file.

    Once I get the idea I will be able to work adding to it out myself.

    Hope you can help.

    SC

  7. #57
    Sencha User
    Join Date
    Sep 2007
    Posts
    11
    Vote Rating
    0
    southside is on a distinguished road

      0  

    Default

    Hi Maxim;

    I have just managed to get it working using your code snippett as the basis.

    This returns

  8. #58
    Sencha Premium Member MaximGB's Avatar
    Join Date
    Jun 2007
    Location
    Moscow, Russia
    Posts
    510
    Vote Rating
    5
    MaximGB is on a distinguished road

      0  

    Default

    Yes it is.
    Use the force - read the source.

  9. #59
    Sencha User jay@moduscreate.com's Avatar
    Join Date
    Mar 2007
    Location
    DC Area =)
    Posts
    16,364
    Vote Rating
    83
    jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all jay@moduscreate.com is a name known to all

      0  

    Default

    Great job! I'm going to see if i can plug this into a back end for a client.

    I got sick of using SWF Upload.
    I was able to implement something like (dev): http://screencast.com/t/i2Hv2SC6

    But when i went to deploy it in production i had HTTP 403s being reported by SWF Uploader. HTML Forms worked great for the upload form, but SWF uploader just would NOT work w/ this web server. Sooo strange.

  10. #60
    Ext JS Premium Member milanz's Avatar
    Join Date
    Aug 2007
    Posts
    47
    Vote Rating
    0
    milanz is on a distinguished road

      0  

    Exclamation Extention case

    Awesome ux.

    Just found a small logic fix. Seems that the permitted_extensions does not take case into consideration. So 'jpg' is not the same as 'JPG' depending how it is named on the user's machine. Simply solved it by defining my allowed extensions in lower case and added the "toLowerCase" as below:

    PHP Code:
      getFileExtension : function(filename)
      {
        var 
    parts filename.split('.');
        if (
    parts.length == 1) {
          return 
    null;
        }
        else {
         return 
    parts.pop().toLowerCase();
        }
      }