import React from "react";
class App extends React.Component {
  upload(e)
  {
    console.warn(e.target.files)
    const files=e.target.files
    const formData=new FormData();
    formData.append("img", files[0])
    fetch('https://management.beanstalkedu.com/items/school',{
      method: 'POST',
      body: formData
    } 
     )
     .then((resp)=>{
      resp.json()
      .then((result)=>{
        console.warn("result", result)
      })
     })
  }
  render(){
    return (
      <div>
        <div className='flex flex-col w-full'>
            <label htmlFor="school_agreement" className='text-xl font-bold pt-4'>Upload School Agreement</label>
            <input type="file" onChange={(e)=>this.upload(e)} name="school_agreement" id="school_agreement" className=' border-2 border-[#FE4501] p-2 rounded-md focus:outline-none focus:border-2 focus:border-[#F2B705]' />
        </div>
      </div>
    );
  }
}
export default App;