0

I have created one form to upload images for custom use

<form id="file-upload" action="" method="POST" enctype="multipart/form-data">
    <div id="image-uploader-box" class="group">           
        <div id="forms" class="add-photo-fields">
            <input type="submit" value="Upload" />
            <input type="button" id="add-photo-button" class="add-photo-button" value="Add Photo"/>
        </div>
    </div> 
</form>

Now it is working fine with uploading image and storing to proper place. But what I exactly want is auto submit above form when user submit WordPress comment. ( when user hit the submit comment button )

Can anyone help me for this? I am fine with jquery or php either way.

UiUx
  • 967
  • 2
  • 14
  • 25
Code Lover
  • 8,099
  • 20
  • 84
  • 154

1 Answers1

0

This is the place to go: http://api.jquery.com/submit/ (jquery's submit function) When uploading files you can post to an iframe: How do you post to an iframe?

Community
  • 1
  • 1
Jan
  • 42,290
  • 8
  • 54
  • 79
  • Please give me some idea how to do. I have read the docs you posted but one is complex for me to understand and other is asp so bumped. – Code Lover Feb 14 '13 at 18:31
  • Rather than fiddling on your own, you could use a plugin: https://github.com/blueimp/jQuery-File-Upload, they have an excellent documentation over here: https://github.com/blueimp/jQuery-File-Upload/wiki/Basic-plugin – Jan Feb 14 '13 at 18:37
  • Thanks for sharing let me try – Code Lover Feb 14 '13 at 18:47
  • But this is too much for my small need. It is not good idea to use too much code and script for one simple need. – Code Lover Feb 14 '13 at 18:48
  • Then you could very well use this one: http://stackoverflow.com/questions/12356936/simple-jquery-file-upload-plugin-using-only-iframes – Jan Feb 14 '13 at 18:50
  • I appreciate your help but rather you are trying to help me with my code you are searching and sharing links with me. I need help with some example code and explanation. – Code Lover Feb 14 '13 at 18:54
  • No I am not. Just want to understand the logic and how to work with this. Also most of the code you share showing either AJAX upload or multiple upload rather I want one form auto submit on another form submission. Which I couldn't understand or not found in those code. – Code Lover Feb 14 '13 at 19:06