Page 3 of 43 FirstFirst 1234513 ... LastLast
Results 21 to 30 of 424

Thread: [2.0] Ext.ux.UploadDialog extension.

  1. #21
    Sencha Premium Member MaximGB's Avatar
    Join Date
    Jun 2007
    Location
    Moscow, Russia
    Posts
    542

    Default

    Thanks for you post Mehdi

    Tha bug you've mentioned was fixed at 28 of December and since the updated extension is available for download.

    I know about uploadprogress php extension but don't want to use it since it's uncommon. So actually a progress bar in the upload dialog is mostly a "UI sugar".

    For other fixes you are proposing there is a "filetest" event It's porpose is for the cases when permitted_extensions is not enough for the user needs.
    Use the force - read the source.

  2. #22
    Sencha Premium Member MaximGB's Avatar
    Join Date
    Jun 2007
    Location
    Moscow, Russia
    Posts
    542

    Default

    Quote Originally Posted by alos View Post
    Now, about the filetest. Is this correct?
    No, the filetest is an event so you should use it same as uploadsuccess

    Code:
    	function getDialog()
    		{
    			if (!dialog) {
    				dialog = new Ext.ux.UploadDialog.Dialog({
    					url: 'upload-dialog-request.php',
    					reset_on_hide: false,
    					allow_close_on_upload: true,
    					upload_autostart: true,
    					permitted_extensions: ['jpg', 'jpeg', 'gif']
    				});
    				dialog.on('uploadsuccess', onUploadSuccess);
                                    dialog.on('filetest', cuenta);
    			}
    			return dialog;
    		}
    		function subirRevista(){
    			var lugar = Ext.getCmp('botonPaSubir');
    			getDialog().show();
    		}
    			
    		function cuenta(){
    			contador++;
    			if(contador>1){
    				return false;
    			}
    			return true;
    		}
    		
    		function onUploadSuccess(dialog, filename, resp_data)
    		{
    			var parts = filename.split(/\/|\\/);
    			if (parts.length == 1) {
    				filename = parts[0];
    			}
    			else {
    				filename = parts.pop();
    			}
    			file_list_tpl.append('file-list', {name: filename});
    		}
    Use the force - read the source.

  3. #23

    Default Plugin

    Quote Originally Posted by MaximGB View Post
    Thanks for you post Mehdi

    Tha bug you've mentioned was fixed at 28 of December and since the updated extension is available for download.

    I know about uploadprogress php extension but don't want to use it since it's uncommon. So actually a progress bar in the upload dialog is mostly a "UI sugar".

    For other fixes you are proposing there is a "filetest" event It's porpose is for the cases when permitted_extensions is not enough for the user needs.
    Alright, Max... Thanks for your responses.

    Very respectfully,
    Mehdi

  4. #24
    Ext User
    Join Date
    Nov 2007
    Posts
    47

    Smile

    Thanks Mehdi, and thanks MaximGB! Im loving this

  5. #25

    Default

    Hi MaximGB

    Nice work... Thanks for your effort.

    I have a small issue.. i am using this with my struts2 application and the server side action class returns {"success":true} but the onAjaxSuccess function is not getting invoked hence i get "uploading error" in the status message. Please help me solve this issue.

    Thanks,
    Thameem

  6. #26
    Sencha Premium Member MaximGB's Avatar
    Join Date
    Jun 2007
    Location
    Moscow, Russia
    Posts
    542

    Default

    Give me a link on a page where I can see the error, or post your code here.
    Use the force - read the source.

  7. #27

    Default

    Great you are online. Thats an internal app so its not accessible from outside. But here is the code.

    I am using Extdesktop application and popping up this dialog window within desktop window. Later I have to figure out how to fit this upload component inside desktop window.

    Javascript:
    Code:
    var dialog = new Ext.ux.UploadDialog.Dialog({
    		        url: '/global/provider/nodec/mediaUpload.action',
    		        reset_on_hide: false,
    		        allow_close_on_upload: true,
    		        upload_autostart: false
    		        //renderTo:'upl-cont'
    	      	});
    dialog.show();
    Javacode:

    Code:
    public String execute() throws Exception {
    		logger.debug("File upload action execute method ");
    		logger.debug("Filename: "+filename);
    		success = true;
    		returnMessage="File uploaded";
    		
    		return SUCCESS;
    	}
    In my struts.xml config file i have this :

    Code:
    <action name="nodec/mediaUpload" class="com.vzw.vcm.core.actions.contentprovider.MediaUploadAction">    		
        		<interceptor-ref name="webAccessStack"/>
        		<interceptor-ref name="fileUpload">
      			<param name="allowedTypes">
         			image/png,image/gif,image/jpeg,application/octet-stream
      			</param>
      			<param name="maximumSize">
      				<!-- approx 2MB in bytes-->
      				2097152
      			</param>
    			</interceptor-ref>
        		<result type="json"/>     		
    		</action>
    I am using json plugin which outputs {"success":true}

    Thanks,
    Thameem

  8. #28
    Sencha Premium Member MaximGB's Avatar
    Join Date
    Jun 2007
    Location
    Moscow, Russia
    Posts
    542

    Default

    Your code gives me no clue where the error is. But since you get 'Upload error' in the 'Note' column of the dialog then your json output is probably invalid. Try to use Fiddler and see what's actualy returning from the upload action.
    Use the force - read the source.

  9. #29

    Default

    I used fiddler and here is the output.

    {"message":"File uploaded","success":true}

    I forgot to mention that the response has content-type:application/json;charset=UTF-8. Firefox prompting me to save the mediaUpload.action file... I am not sure its because of json content type.

    Thanks,
    Thameem

  10. #30
    Sencha Premium Member MaximGB's Avatar
    Join Date
    Jun 2007
    Location
    Moscow, Russia
    Posts
    542

    Default

    Check the response headers, the response content type should be text/html, not application/xml or application/json
    Use the force - read the source.

Page 3 of 43 FirstFirst 1234513 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •