1. 업로드 가능 한지 확인 중 페브릭쪽 선택하고 업로드하면 됨 2. 안되는 이유확인: 1번처럼 선택안하면 cid가 들어가지않아 동작을 안하는것으로 보였는데 실질적으론 selectChildCategory 에서 리스트를 가지고올때 설정된 cid ? 를 이용하는건지 정확하진않지만 cid 사용해서 하는것으로 보임. 밑의 소스처럼 했을시 업로드는 가능함 . 3. 업로드 하다보면 무한으로 얼럿 띄우는것을 볼수있다 (밑의 소스처럼 중간에 child라던지 menu단에서 써서 그런지 모르겠지만 여러번 뜰때가 있음. ) ※ 확인 했을땐 fabric 창과 product 창 왔다갔다 많이 하고 올리면 그런경우를 봤음. 4.product에서 올릴때 왜 중간에 fabric의 cid를 가지고오는지모르겠지만 막아도 올라가는 경우를 볼수있다. ※로직에 문제가있을 수 있음 ----------------------------------------------------------source--------------------------------------------------------------- wv.setCategory = function(type) { console.log("누가먼저") var categoryList = wv.data.category[type], $cList, cid, $parentCategory, $childCategory, childCategory if (productCategoryNum == null) { var startCid = categoryList[0].childCategory[0].id wv.getProductList(startCid); wv.setUploader('product',startCid); }else if(productCategoryNum != null){ wv.setUploader('product',startCid); } ----------------------------------------------------------------------------------------------------------------- wv.selectChildCategory = function(type, $childCategory, categoryId) { // $('.sideNavAcco > li > ul > li').removeClass('selected'); // $childCategory.addClass('selected'); categoryIdW = categoryId; // wv.state.selectCategory[type].lev2idx = $childCategory.index(); if (type === "product") { wv.getProductList(categoryId); wv.setUploader(type,categoryId); } else if (type === "fabric") { wv.getFabricList(categoryId); wv.setUploader(type,categoryId); console.log(categoryId); } }; --------------------------------------------------------------------------------------- wv.setUploader = function(type,cid) { if(document.getElementById("uploadFabricInput")){ $("#uploadFabricInput").remove(); } /* var uploadInput = document.createElement("INPUT"); uploadInput.setAttribute("type", "file"); uploadInput.setAttribute("class", "inp-file-fabric"); uploadInput.setAttribute("name", "file-image-fabric"); uploadInput.setAttribute("id", "uploadFabricInput"); uploadInput.setAttribute("accept", ".png, .jpg, .jpeg"); uploadInput.hidden; $("#uploadForm").append(uploadInput);*/ console.log(type); $('.inp-file-fabric').on('change', function() { if(type=='product'){ alert('Fabric tab에서 올려주시기 바랍니다.'); }else if(type=='fabric'){ var formData = new FormData($("#uploadForm")[0]); formData.append('Type', 'true'); formData.append('CID', cid); console.log(cid); $.ajax({ url: '/manager/fabric/create', type: 'POST', data: formData, contentType: false, processData: false, success: function (id, filename, response) { if (response['success']) { alert('Fabric을 추가하셨습니다.'); wv.getFabricList(cid); } else { switch (response['reason']) { case 'Anonymous': alert('please login first'); break; case 'NoCategory': alert('none of categories selected.'); break; default: alert('please login or select a fabric category.'); return false; break; } } $('#uploadForm')[0].reset(); } }); } }); }; --------------------------------------------------------------------------------------------------------------------