Ajax upload in a form

Links for php scripts

Moderators: macek, egami, gesf

lonelygirl86
New php-forum User
New php-forum User
Posts: 14
Joined: Mon Jan 09, 2012 12:05 am

Ajax upload in a form

Postby lonelygirl86 » Mon Jan 09, 2012 12:54 am

Hi i have this form. The main function of this form is that once upload button is clicked it will upload the file. Then, once submit button is clicked, it will submit the form. Save all the information into the database.

Code: Select all

<form method="post" name="myForm" enctype="multipart/form-data"/>
         <div class="wrapper">
            <label class="label">Name :</label>
            <input type="text" name="fname" id="fname" class="wrap-input" size="65"/>
         </div>
         <div class="wrapper">
            <label class="label">Logo :</label>
            <input type="file" name="logo" />
            <input type="button" name="uploadcontent" value="Upload"/>
         </div>
         <div class="wrapper">
            <label class="label">Email :</label>
            <input type="text" name="email" id="email" class="wrap-input" size="65"/>
         </div>
         <div class="wrapper">
            <label class="label">Phone :</label>
            <input type="text" name="phone" id="phone" class="wrap-input" size="65"/>
         </div>
         <div class="wrapper">
            <label class="label">Upload Content (.doc, pdf, images) :</label>
            <input type="file" name="content" />
            <input type="button" name="uploadcontent" value="Upload"/>
         </div>   
      <div class="wrapper">
            <label class="label">&nbsp;</label>
            <input type="submit" name="save" value="Save"/>            
         </div>   
</form>   


I found this pretty good site to upload file without refreshing the page but this is for a single input only meaning it works only if you only have 1 input file in each form. See this link:

http://www.ajaxf1.com/tutorial/ajax-fil ... orial.html

But my form has an input texts and 2 upload file button. Any idea how would i do it using the script that i found in the web?

I need this form, that everytime the upload button is clicked it will upload the file into the directory that i assigned so that once i submit the form it will just automatically save the form data to the database, no need for me to have the upload function.This way, the form submission would be much faster.

Give me some idea guys.. please? thank you

lonelygirl86
New php-forum User
New php-forum User
Posts: 14
Joined: Mon Jan 09, 2012 12:05 am

Re: Ajax upload in a form

Postby lonelygirl86 » Mon Jan 09, 2012 5:53 pm

Can someone walk me through on this? please


Return to “PHP Scripts”

Who is online

Users browsing this forum: No registered users and 2 guests