• Sohan Raj
  • 15 Points
  • Member since 2017

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
  • 2

I am using Dropzone for upload file drag and drop. But when I submit form then it gives error required BODY is missing. Without dropzone its working correct.

I am using below code:
<apex:form id="dropzoneForm" styleClass="dropzone1">
                                                                                <div class="fallback">
                                                                                    <apex:inputFile id="profilePhoto" value="{!profilePhoto}" />
                                                                                <br />
                                                                                <br />
                                                                                <apex:commandButton action="{!saveProfilePhoto}" title="Save Changes" value="Save Changes" styleClass="btn btn-primary btn-sm btn-block btnsave" id="btnsave"/>

Dropzone.options.dropzoneForm = {
            paramName: "file", // The name that will be used to transfer the file
            maxFilesize: 2, // MB
            dictDefaultMessage: "<strong>Drop files here or click to upload. </strong>"

Apex Code:
public PageReference saveProfilePhoto()
            Attachment profilePhotoObj = new Attachment();
            profilePhotoObj.body = profilePhoto;
            profilePhotoObj.ParentId = artist.id;
            insert profilePhotoObj;
            String attachedPhotoId = profilePhotoObj.id;
            String profilePhotoObjId = attachedPhotoId.subString(0,15);
            artist.Artist_Photo__c  = '/servlet/servlet.FileDownload?file='+profilePhotoObjId ;
            upsert artist;
            artistId = ApexPages.currentPage().getParameters().get('artistId');
            //system.debug('artist id ='+artistId );
            PageReference pg = new PageReference('/apex/Profile?artistid='+artistId );
            return pg;
        catch(Exception ex)
        return null;

Can anyone please provide code for this using dropzone.

Sohan Raj Gupta
I am using dropzone multi-upload Drag and Drop upload into salesforce.Its working fine on all browsers except IE.
Also on IE as well its not working in only 1 scenario..when i have reRender on the page..If i remove reRender it works.Please help i am stuck on this for 2 weeks.
Script starts like below.
   // j$ = jQuery.noConflict();
        var myChatterDropzone;
        var recordId;

        // Try to find the Id of the record we are looking at, if any.
        var documentText = dz_jQuery('html').html();
        var tokenStart = documentText.indexOf("ResponseRequestedURL=") ;
        var documentEnd = documentText.substr(tokenStart,documentText.length);
        var tokenEndIndex = documentEnd.indexOf("');");
        //recordId = documentEnd.substr(tokenEndIndex-15,15);

<apex:form >
 <apex:outputPanel id="test1" rendered="false" >
 <apex:commandButton value="tesr" rendered="false" reRender="none"/>
If i just remove reRender from above command button it works perfectly. The above command is not linked at all with upload functionality but just removing it from page works for me. :(



I have a VF page where in I am using case standard controller.

The first time when the page is displayed 2 input fields (eg.) are there i.e. Name and Email. which are static. Another 2 fields are their like Vendor Name and Vendor Contact No. which are dynamic.


Now, I want to implement the functionality wherein if a user clicks on Add Row button,  1more row will appear to enter a value in both  the fields(Vendor name and Vendor Contact No.). So, if he clicks the button 5 times, 5 rows shud appear with thses two columns.

After providing the inputs, he will click on "Save " button, and the record should be saved wherein the inputs provided in multiple rows should be saved into the related list of the Case detail page (Case details page will contain the information like Name and Email). Request you to please forward me the code for the above mentioned functionality. Since its a n urgent requirement. An early reply will be highly appreciated. Thanks.

  • May 07, 2010
  • Like
  • 0