1
Watch
0
Star
1
Fork
0
Issue

SYSTEM TO MANAGE WEBSITE CONTENT

DiegoSantosWS
DiegoSantosWS
pushedAt 3 years ago

DiegoSantosWS/cms

cms

CMS USING Go!

System is just a content manager for sites with few pages. The installation part is being developed.

How it works

  • 1 - Create database and make the necessary user and password connections.
  • 2 - Create a username and password of type Admin.
  • 3 - Installation.
  • 4 - Just start using it on your website.

Installation

By default system runs on the port http://localhost:3000/

After creating the database, access the file conexao.go and change connection data for your username and password

URL: http://localhost:3000/install

After performing the install, set whether the system created the tables correctly, if not, you have created copy the code that is in the root and run in your database. after that, just access, the URL: http://localhost:3000/ enter your username and password.

Sending File

Example

func Upload(w http.ResponseWriter, r *http.Request) {
	r.ParseMultipartForm(32 << 20)
	files, handler, err := r.FormFile("uploadfile")
	if err != nil {
		fmt.Println(err.Error())
		return
	}
	defer files.Close()
	//fmt.Fprintf(w, "%v", handler.Header)
	//New name from file
	namenewFile := time.Now().Format("02012006150405") + handler.Filename

	f, err := os.OpenFile("assets/uploadfile/"+namenewFile, os.O_WRONLY|os.O_CREATE, 0666)
	if err != nil {
		fmt.Println(err.Error())
		return
	}
	defer f.Close()
	io.Copy(f, files)
	idcontent, err := strconv.Atoi(r.URL.Path[12:])
	if err != nil {
		fmt.Println(err.Error())
	}
	s := fmt.Sprintf("/conteudo/%d", idcontent)
	http.Redirect(w, r, s, 302)
}
ucloud ads