how to assign file while editting record with other fields

  •  12-22-2010, 12:07 AM

    how to assign file while editting record with other fields


    I am using file uploader with other fields.
    Here is my code for uploader.
                       $uploader=new PhpUploader();
                        $uploader->Name="ufile1";
                        $uploader->MaxSizeKB=102400;  
                        $uploader->AllowedFileExtensions="*.mp3,*.mp4,*.wma";    
                        $uploader->ManualStartUpload=true;
                        $uploader->ShowProgressInfo=false;   
                        $uploader->FlashUploadMode="Http";
                        $uploader->Render(); 
     
    function doStart()
        {
            if(document.getElementById('ufile1'))
            {
                var uploadobj = document.getElementById('ufile1');
                if (uploadobj.getqueuecount() > 0)
                {
                    uploadobj.startupload();
                }else
                    {
                        alert("Please browse file for upload");
                    }
            }
            
            if(document.getElementById('newimage'))
            {
                var uploadobj2 = document.getElementById('newimage');
                if (uploadobj2.getqueuecount() > 0)
                {
                    uploadobj2.startupload();
                }else
                    {
                        alert("Please browse image file for upload");
                    }
            }        
        }
     
    function validate()
    {

        if(document.frmaddfiles.name1.value=='')
          {
               alert("Please Enter Filename.");
               document.frmaddfiles.name1.focus();
               return false;
          }

        
        if(document.frmaddfiles.descr.value.length < 1)
          {
               alert("Please Enter Description.");
               document.frmaddfiles.descr.focus();
               return false;
          }       
        if(document.frmaddfiles.rdate.value.length < 1)
          {
               alert("Please Select Release Date.");
               document.frmaddfiles.rdate.focus();
               return false;
          }
        

        if(document.frmaddfiles.active.value=='')
          {
               alert("Please Select Status.");
               document.frmaddfiles.active.focus();
               return false;
          }
          return true;
    }
     
    <form name="frmaddfiles" action="sub_files.php" method="post" onSubmit="return validate();" target="_parent" enctype="multipart/form-data">
     
     
    Now, when i submit this form, it calls 'doStart()' method .And I have to write 'return false' here.
    <input name="Submit" type="submit"  value="SUBMIT" onClick="doStart();return false;">
    and onsubmit  it calls validation method for other records in form.
     
    While Adding it works fine. but when I edit just name in this form. (Please see the image below.its second file uploader.if i delete it shows me button for browse) it doesnt allow me to submit the form.
     

                  
     
     
     
    Waiting for replay.
    .
     
View Complete Thread