ไฟล์สกุล python กับ html สามารถนำมารันใน php ได้ไหมคะ
Moderator: mindphp, ผู้ดูแลกระดาน
-
- PHP Jr. Member
- โพสต์: 29
- ลงทะเบียนเมื่อ: 22/10/2019 4:11 pm
ไฟล์สกุล python กับ html สามารถนำมารันใน php ได้ไหมคะ
ไฟล์สกุล python กับ html สามารถนำมารันในphp ได้ไหมคะ
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41338
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: ไฟล์สกุล python กับ html สามารถนำมารันในphp ได้ไหมคะ
ต้องการทำอะไรหรือครับ
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
-
- PHP Jr. Member
- โพสต์: 29
- ลงทะเบียนเมื่อ: 22/10/2019 4:11 pm
Re: ไฟล์สกุล python กับ html สามารถนำมารันในphp ได้ไหมคะ
ต้องการทำ report ค่ะ ประมาณว่า อัพโหลดรูปแล้วมีการระบุวันเวลาตามที่เรา select ลงไป ข้อมูลทั้งหมดจะดึงไปเก็บไว้ใน database
แต่ตอนนี้ทำ ตัวอัพโหลดรูปเก็บลงใน database ได้แล้ว เหลือ select วันเวลาส่วนตัวคิดว่าทำใน php น่าจะง่ายกว่าเพราะทำpythonไม่เป็นค่ะ
แต่ตอนนี้ทำ ตัวอัพโหลดรูปเก็บลงใน database ได้แล้ว เหลือ select วันเวลาส่วนตัวคิดว่าทำใน php น่าจะง่ายกว่าเพราะทำpythonไม่เป็นค่ะ
-
- PHP Jr. Member
- โพสต์: 29
- ลงทะเบียนเมื่อ: 22/10/2019 4:11 pm
Re: ไฟล์สกุล python กับ html สามารถนำมารันในphp ได้ไหมคะ
ทำยังไงให้ขึ้นวันที่และเวลาที่เราอัพโหลดคะ
ไม่แน่ใจว่าโค้ดผิดตรงไหนค่ะ
ไม่แน่ใจว่าโค้ดผิดตรงไหนค่ะ
โค้ด: เลือกทั้งหมด
import os
from flask import Flask,request, render_template
import pymysql
from flask_sqlalchemy import SQLAlchemy
import datetime
app=Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'mysql+pymysql://incuser:loglin@localhost/myweb'
db= SQLAlchemy(app)
class pic(db.Model):
idpic = db.Column(db.Integer, primary_key=True)
caption = db.Column(db.String(45))
img = db.Column(db.LargeBinary)
@app.route('/')
def index():
return render_template('report.html')
@app.route ('/upload', methods=['POST'])
def upload():
file = request.files['filename']
newfile = pic( caption=file.filename, img=file.read())
db.session.add(newfile)
db.session.commit()
now = datetime.datetime.now()
return 'Saved ' + file.filename + now + 'to the database'
if __name__=='__main__':
app.run(port=8000)
app.debug=True
โค้ด: เลือกทั้งหมด
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="UTF-8">
<title>Report</title>
</head>
<body>
<form action="/upload" method="POST" enctype = "multipart/form-data">
<h1>Report Machine</h1>
<input name="filename" type="file">
<input type="submit" value="ok">
</form>
</body>
</html>
- แนบไฟล์
-
- Capture.JPG (15.45 KiB) Viewed 1027 times
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41338
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: ไฟล์สกุล python กับ html สามารถนำมารันในphp ได้ไหมคะ
ขึ้นที่ไหน ครับ
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
-
- PHP Jr. Member
- โพสต์: 29
- ลงทะเบียนเมื่อ: 22/10/2019 4:11 pm
Re: ไฟล์สกุล python กับ html สามารถนำมารันในphp ได้ไหมคะ
ขึ้นใน database ค่ะ
-
- PHP Jr. Member
- โพสต์: 29
- ลงทะเบียนเมื่อ: 22/10/2019 4:11 pm
Re: ไฟล์สกุล python กับ html สามารถนำมารันในphp ได้ไหมคะ
ให้ใน table มันขึ้นวันและเวลาที่เราเอารูปเก็บข้อมูลใน database
- แนบไฟล์
-
- Capture.JPG (15.45 KiB) Viewed 1020 times
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41338
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: ไฟล์สกุล python กับ html สามารถนำมารันในphp ได้ไหมคะ
โค้ด python ที่ยกมายังไม่มี ส่วนของการบันทึกข้อมูลลงฐานข้อมูลเลยนะครับ
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
-
- PHP Jr. Member
- โพสต์: 29
- ลงทะเบียนเมื่อ: 22/10/2019 4:11 pm
Re: ไฟล์สกุล python กับ html สามารถนำมารันในphp ได้ไหมคะ
return 'Saved ' + file.filename + now + 'to the database'
อันนี้ไม่ใช่ ส่วนเก็บข้อมูล database หรอคะ
อันนี้ไม่ใช่ ส่วนเก็บข้อมูล database หรอคะ
- mindphp
- ผู้ดูแลระบบ MindPHP
- โพสต์: 41338
- ลงทะเบียนเมื่อ: 22/09/2008 6:18 pm
- ติดต่อ:
Re: ไฟล์สกุล python กับ html สามารถนำมารันในphp ได้ไหมคะ
ส่วนนั้นแค่ ส่งค่าเป็น text ออกจาก ฟังก์ชั่นการทำงาน
เนื่องจากโค้ดที่ยก มาน่าจะไม่ใช่ โค้ดทั้งหมด
ลองเช็ค การทำงานในส่วนนี้
ฟังก์ชั่น pic() กับ db.session.add() ว่าเขียนไว้ให้ทำอะไร บ้าง ส่ง parameter อะไร เข้าไปบ้าง
เนื่องจากโค้ดที่ยก มาน่าจะไม่ใช่ โค้ดทั้งหมด
ลองเช็ค การทำงานในส่วนนี้
โค้ด: เลือกทั้งหมด
newfile = pic( caption=file.filename, img=file.read())
db.session.add(newfile)
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
-
- Similar Topics
- ตอบกลับ
- แสดง
- โพสต์ล่าสุด
-
-
โพสต์ใหม่ สอบถามค่า python มีฟังก์ชั่นปัดเศษเหมือน Roundup ของ google sheet ไหมคะ
โดย MBMoo » 14/03/2023 9:26 am » ใน Programming - C/C++ & java & Python - 2 ตอบกลับ
- 1877 แสดง
-
โพสต์ล่าสุด โดย mindphp
14/03/2023 9:46 am
-
-
-
โพสต์ใหม่ สอบถามเรื่องการเขียนโค๊ด python ภายใต็ HTML
โดย nuattawoot » 21/06/2017 11:56 am » ใน Programming - C/C++ & java & Python - 1 ตอบกลับ
- 604 แสดง
-
โพสต์ล่าสุด โดย mindphp
21/06/2017 12:32 pm
-
-
-
โพสต์ใหม่ สอบถาม wrap ค่าใน value ทะลุหน้าจอ ของ python บน html ค่ะ
โดย MBMoo » 11/06/2020 6:18 pm » ใน Programming - C/C++ & java & Python - 2 ตอบกลับ
- 897 แสดง
-
โพสต์ล่าสุด โดย MBMoo
12/06/2020 10:58 am
-
-
-
โพสต์ใหม่ การเขียน class object ของ python และให้ return เรียกใช้ บน html รูปแบบเป็นแบบไหนคะ
โดย MBMoo » 12/06/2020 1:07 pm » ใน Programming - C/C++ & java & Python - 5 ตอบกลับ
- 1688 แสดง
-
โพสต์ล่าสุด โดย MBMoo
13/06/2020 10:34 am
-
-
-
โพสต์ใหม่ ต้องการจะสร้างไฟล์ HTML เเต่นำค่า php ไป HTML โดย Twig เขียนใน phpbb จะทำยังไงคะ
โดย thatsawan » 24/06/2020 5:45 pm » ใน Programming - PHP - 3 ตอบกลับ
- 4206 แสดง
-
โพสต์ล่าสุด โดย Sirayu
25/06/2020 3:49 pm
-
ผู้ใช้งานขณะนี้
สมาชิกกำลังดูบอร์ดนี้: ไม่มีสมาชิกใหม่ และบุคลทั่วไป 79