I have 4 categories on my form. Each has 2 file type input. Here is an example of one:
- <div class="row">
- <div class="file-field input-field col s6">
- <div class="btn">
- <span>MANILA</span>
- <input type="file" id="mnl_process">
- </div>
- <div class="file-path-wrapper">
- <input class="file-path validate" type="text">
- </div>
- </div>
- <div class="file-field input-field col s6">
- <div class="btn">
- <span>IN-COUNTRY</span>
- <input type="file" id="inc_process">
- </div>
- <div class="file-path-wrapper">
- <input class="file-path validate" type="text">
- </div>
- </div>
- </div>
So I need 4 of that code all I have to do is change the id from mnl_x to inc_x where x is the name of the category. In this case the category name is process.
I know AJAX, jQuery and PHP but I haven't tried to do uploads.
How should I approach this properly? So I can attach it under one button.
Here is my jQuery idea:
- $("#upload_values").click(function() {
- $("input[type=file]").each(function(){
- //I'll insert ajax post here but I don't know how upload
- });
- });