Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- btnsubmit.click(function(){
- var file_data = $('#uploaded_img').prop('files')[0];
- var form_data = new FormData();
- form_data.append('file', file_data);
- $.ajax({
- url: 'upload_img_custom.php',
- cache: false,
- contentType: false,
- processData: false,
- data: form_data,
- type: 'POST',
- success: function(php_script_response){
- alert(php_script_response);
- }
- });
- });
- <?php
- $upload_directory = "../uploads/Customized/";
- if (isset($_FILES['uploaded_img']))
- {
- $uploadedFileName=$_FILES['uploaded_img']['name'];
- $targetPath=time().$uploadedFileName; //time is concatenated to make filenames unique
- if($uploadedFileName != '')
- {
- $targetPath=time().$uploadedFileName;
- move_uploaded_file($uploadedFileName, $upload_directory."".$targetPath);
- }
- }
- header('Location: customize.php?upload=success');
- ?>
- <form method=POST id=customize-form action ="" enctype=multipart/form-data>
- <div id=step3 class='options step'>
- <section class=section-title>Image</section>
- <div class=image-display><img id=image-disp src="" width=99 style="text-align:center" /></div> //div for displaying uploaded image
- <section style="margin-bottom:10px">
- <label class="paragraph-font2 full-width">Choose what you want on the top of your cake:</label>
- </section>
- <section style="margin-bottom:15px">
- <input class="paragraph-font2 full-width" type=file name=uploaded_img id=uploaded_img accept="image/*">
- </section>
- </div>
- <button type=submit class='btn btn-info action submit'><span class='glyphicon glyphicon-shopping-cart'></span> Add to cart</button>
- </form>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement