ZJSK.COM
welcome to my space
X
Search:  
 HOME   Upload issue
Upload issue
Published by: mike 2010-03-11
Welcome to:zjsk.com

  • Hi everyone,
    i am wondering how to be able to upload a file using extjs, php and a mysql db...
    I have a form(called register) with several fields, one of them happens to be a FileUploadField (i want to upload a picture associated to the form).
    Anyway, when i submit my form i launch the following function :

    function create(){
    Ext.Ajax.request({
    waitMsg: 'Please wait...',
    url: 'registration.php',
    action:'submit',
    params: {task: "create" , name:form_name.getValue(), lastname:form_lastname.getValue(),picture:form_pic ture.getValue()},
    Does posting my photo of a book cover violate ::
    If a particular website addresses this issue, I would appreciate that . [8] If a photographer were to upload this kind of photo, some tangible print
    http://answers.google.com/answers/threadview?id=356201
    HOME
    success: function(response){
    var result=eval(response.responseText);
    switch(result){
    case 1:
    Ext.MessageBox.alert('Congratulations','You are ow registered');
    register.getForm().reset();
    break;
    default:
    Ext.MessageBox.alert('Warning','warning');
    break;
    }
    },
    failure: function(response){
    var result=response.responseText;
    Ext.MessageBox.alert('error','could not connect to the database. retry later');
    }
    });
    }

    The thing is that i get well the name of the picture, but not the picture itself, it doesn't seem to be transfered to my server...
    I am sure i am wrong around this getValue() thing, but i don't know how to solve it...
    Anyone to give me a hand please ?

    Thanks


  • The thing is that i don't know how to combine the register.getForm().submit() and to pass some parameters in the function as :
    Point of sale system comparisons::
    with Accounting software and then upload to Headquarters. At issue is not which applications to computerize; the foodservice industry has outgrown the
    http://answers.google.com/answers/threadview/id/211212.html
    HOME

    params :{task :"create", date_added:form_date_added.getValue().format('Y-m-d')}

    could you give me an example please ?


  • (light) working php to upload an image - you figure out how to insert it into your db.
    $target_path = "images/";

    $fileName = basename( $_FILES['image']['name']);
    $target_path = $target_path .$fileName;

    if(move_uploaded_file($_FILES['image']['tmp_name'], $target_path)) {
    echo "{success: true, imgPath : '" . $target_path . "', fileName : '$fileName'}";

    }
    else{
    echo "{ success: false, msg : 'There was an error!'}";
    }
    ?>


  • try fileUpload : true on your form and use the form's submit method.


  • This is an upload panel that uses the Ext file upload field (see examples for the source)

    ImageUploadPanel = function (config) {
    var win;
    var form;
    var previewPanel;
    var fileField;

    return {

    init : function(config) {
    fileField = new Ext.form.FileUploadField({
    width : 350,
    emptyText : 'Select an image',
    fieldLabel : 'Image',
    name : 'image',
    buttonCfg : {
    text : '',
    iconCls : 'upload-icon'
    },
    listeners : {
    fileselected : {
    scope : this,
    fn : this.submit
    }
    },
    getValue : function() {
    return(this.manualValue);
    }
    });

    if (! win) {
    form = new Ext.form.FormPanel({
    fileUpload : true,
    labelWidth : 50,
    height : 50,
    width : 475,
    region : 'north',
    border : false,
    bodyStyle : 'padding: 10px; background-color: #DFE8F6',
    items : fileField
    });

    previewPanel = new Ext.Panel({
    html : 'preview area',
    region : 'center',
    width : 475,
    autoScroll : true,
    bodyStyle : 'padding: 10px; background-color: #DFE8F6',
    border : false
    });


    win = new Ext.Window({
    width : 500,
    height : 400,
    layout : 'border',
    title : 'Please Select an image to upload.',
    border : false,
    resizable : false,
    movable : false,
    modal : true,
    closeAction : 'hide',
    autoScroll : true,
    items : [
    form,
    previewPanel
    ],
    buttons : [
    {
    text : 'Save',
    handler : function() {
    //console.info('fileField.getValue() = ' + fileField.getValue());
    this.saveCallback(fileField.getValue());
    this.hide.defer(100);

    },
    scope : this
    },
    {
    text : 'Cancel',
    handler : this.hide,
    scope : this
    }
    ]

    });

    }

    },


    show : function(config) {
    config = config {};
    this.init(config);
    this.saveCallback = config.saveCallback Ext.emptyFn;
    win.show();
    if (config.reset) {
    this.reset();
    }
    },
    hide : function() {
    win.hide();
    },


    reset : function() {
    form.getForm().reset();
    previewPanel.body.update('Please upload an image.');
    },
    submit : function() {
    win.el.mask('please wait...', 'x-mask-loading');
    form.form.submit({
    url : 'imageUploader.php',
    success : function(form, result) {
    //console.info(result);
    fileField.manualValue = result.result.fileName;
    previewPanel.body.fadeOut({
    callback : function() {
    win.el.unmask();
    Ext.MesssageBox.alert(result.result.fileName);
    }
    });


    },
    failure : function(form, result) {
    win.el.unmask('please wait...', 'x-mask-loading');
    previewPanel.body.update('Please upload an interaction process PNG, JPG or GIF.');
    },
    scope : this

    });


    }




    }



    }();


  • So are the fields all children of the same form?


  • are they all in one form?





  • Heres my question?
    Why would someone get bored with doing IT for 10 years?

    You are looking at:zjsk.com's Upload issue, click zjsk.com to home
  • necessity of search engine optimization
  • seo strategies optimize press releases for online visibility
  • the learning curve of generating web site traffic
  • feed your users with quality content
  • the art of website optimization and promotion
  • what a logotype is and the right way to create it
  • what is seo
  • seo search engine optimization basics – part i
  • google best search engine optimization seo practices – part 4
  • why is search engine optimization essential to online success
  • top 25 seo myths that you should be aware of
  • increase your website traffic
  • introduction to the web marketing
  •  
  • directory submission – way to link popularity
  • scan of google analytics services
  • how to get better search engine ranks
  • new market share data shows the key to site optimization
  • reciprocal links good for seo google ranking
  • website design and web development
  • link building solving this mystery
  • rss feed submission established as a good seo linking campaign
  • best ways to generate free web site traffic
  • which one is better natural seo or ppc advertising
  • seo search engine optimization basics – part ii
  • how to get high rankings on search engine results page
  • choose an outsourcing company that follows proper search engine optimization strategy
  • google best search engine optimization seo practices part 5
  •  Homepage | Add to favorites | Contact us | Exchange links | LOGIN | Site map | 
    Copyright© 2008 zjsk.com        Site made:CFZ