异步加载css文件

基于python的最简单jQuery File Upload示例

妙音 posted @ 2015年3月27日 13:42 in webui with tags python flask jquery , 13282 阅读
找到个很不错的文件上传插件jQuery File Upload. 资料太少. 只能自己搭个环境,照着例子摸索. 奈何最简单的例子是基于php的, 不熟. 弄了个基于python的例子.
  • github
https://github.com/blueimp/jQuery-File-Upload
  • 目录
使用flask做了个简单web服务器,接收上传请求. 目录结构如下
https://github.c➜  flask-demo  tree
.
├── app.py
├── static
│   ├── 123.txt
│   └── file-upload
│       ├── angularjs.html
│       ├── basic.html
│       ├── basic-plus.html
│       ├── blueimp-file-upload.jquery.json
│       ├── bower.json
│       ├── CONTRIBUTING.md
│       ├── cors
│       │   ├── postmessage.html
│       │   └── result.html
│       ├── css
│       │   ├── demo.css
│       │   ├── demo-ie8.css
│       │   ├── jquery.fileupload.css
│       │   ├── jquery.fileupload-noscript.css
│       │   ├── jquery.fileupload-ui.css
│       │   ├── jquery.fileupload-ui-noscript.css
│       │   └── style.css
│       ├── Gruntfile.js
│       ├── img
│       │   ├── loading.gif
│       │   └── progressbar.gif
│       ├── index.html
│       ├── jquery-ui.html
│       ├── js
│       │   ├── app.js
│       │   ├── cors
│       │   │   ├── jquery.postmessage-transport.js
│       │   │   └── jquery.xdr-transport.js
│       │   ├── jquery.fileupload-angular.js
│       │   ├── jquery.fileupload-audio.js
│       │   ├── jquery.fileupload-image.js
│       │   ├── jquery.fileupload-jquery-ui.js
│       │   ├── jquery.fileupload.js
│       │   ├── jquery.fileupload-process.js
│       │   ├── jquery.fileupload-ui.js
│       │   ├── jquery.fileupload-validate.js
│       │   ├── jquery.fileupload-video.js
│       │   ├── jquery.iframe-transport.js
│       │   ├── jquery.min.js
│       │   ├── main.js
│       │   └── vendor
│       │       └── jquery.ui.widget.js
│       ├── package.json
│       ├── README.md
│       ├── server
│       │   ├── gae-go
│       │   │   ├── app
│       │   │   │   └── main.go
│       │   │   ├── app.yaml
│       │   │   └── static
│       │   │       ├── favicon.ico
│       │   │       └── robots.txt
│       │   ├── gae-python
│       │   │   ├── app.yaml
│       │   │   ├── main.py
│       │   │   └── static
│       │   │       ├── favicon.ico
│       │   │       └── robots.txt
│       │   ├── node
│       │   │   ├── package.json
│       │   │   ├── public
│       │   │   │   └── files
│       │   │   │       └── thumbnail
│       │   │   ├── server.js
│       │   │   └── tmp
│       │   └── php
│       │       ├── files
│       │       ├── index.php
│       │       └── UploadHandler.php
│       ├── test
│       │   ├── index.html
│       │   └── test.js
│       └── test.html
└── templates
    └── index.html

23 directories, 57 filesom/blueimp/jQuery-File-Upload
  • app.py
#encoding=utf-8
from flask import Flask
from flask import request
from flask import abort, redirect, url_for
from flask import render_template
import json

app = Flask(__name__)


@app.route('/')
def index():
    return render_template('index.html')


@app.route('/upload', methods=['GET', 'POST'])
def upload_file():
    if request.method == 'POST':
        f = request.files['files[]']
        filename = f.filename
        minetype = f.content_type
        f.save('static/' + filename)
    return json.dumps({"files": [{"name": filename, "minetype": minetype}]})


if __name__ == '__main__':
    app.run(host="0.0.0.0", port=7000, debug=True)
  • demo.html
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>jQuery File Upload 示例</title>
</head>
<body>
<input id="fileupload" type="file" name="files[]" data-url="/upload" multiple>
<script src="/static/file-upload/js/jquery.min.js"></script>
<script src="/static/file-upload/js/vendor/jquery.ui.widget.js"></script>
<script src="/static/file-upload/js/jquery.iframe-transport.js"></script>
<script src="/static/file-upload/js/jquery.fileupload.js"></script>
<script>
$(function () {
    $('#fileupload').fileupload({
        dataType: 'json',
        done: function (e, data) {
            $.each(data.result.files, function (index, file) {
                $('<p/>').text(file.name).appendTo(document.body);
            });
        }
    });
});
</script>
</body> 
</html>
试了之后,确实很不错.
 
Avatar_small
Buy a 314 Area code 说:
2018年7月19日 15:22

Buy a 314 Area code Phone Numbers

Avatar_small
192.168.0.1 说:
2023年8月10日 17:16

El enrutador WiFi conecta diferentes dispositivos a la interfaz de red, cualquier usuario necesita usar el nombre de usuario y la contraseña para iniciar sesión en la interfaz de credenciales del enrutador y 192.168.0.1 luego puede configurar los ajustes del enrutador, ya que generalmente la naturaleza humana olvida algo después de mucho tiempo. Entonces, cuando un usuario olvida el nombre de usuario y la contraseña de la consola de administración del enrutador, no hay necesidad de entrar en pánico y hay una solución para recuperarse.

Avatar_small
Goa 10th Class Text 说:
2023年8月11日 12:48

The Printed Gujarat 7th Class Textbook 2024 are Distributed Through Cooperative Institutions All over Gujarat. Vendors are Linked to the Distribution of Textbooks with Distributors in each District. Gujarat Board Class Book 2024 are easily Accessible to All Students of This System, This will assist in improving the Quality of Teaching by Understanding the Type of Difficulties GSEB 7th Class Textbook 2024 Faced by Students of Class in Different Subjects Reading Comprehension, Mathematics and Environmental Studies. This is an effort to Provide Feedback for Planning interventions at Various Levels of School Education.

Avatar_small
Imamia Quran Academy 说:
2023年8月12日 06:59

Hi everyone, I really love your story. You have very useful information; I am from Imamia Quran Academy. Online Shia Quran Institute has all the necessities for exceptional Shia Online Quran Learning. An established system of Quranic teaching and lessons with trained teaching staff greatly enhances the learning experience.

Avatar_small
SCERT Bihar 1st Cla 说:
2023年9月02日 14:41

Bihar Board 1st Question Paper 2024 Available From its our website in Hindi and English Medium Pdf Format. SCERT Bihar Board Upload Examination Department usually Question Bank in Every year Month of October, Bihar Board Important Question Paper 2024 help the Students to get an idea about the Annual Exam 2020. Bihar Model Test Paper 2024 is Provided by the State Council of Educational Research SCERT Bihar 1st Class Model Paper 2024 and Training,Bihar Only,Bihar Board Model Paper 2024 have been Upload to Reveal the Exam Pattern to be Followed in SCERT Bihar Class Final Exam 2024, Bihar Class Latest Details along with Links to Download SCERT Bihar Question Paper 2024.

Avatar_small
Evan77 说:
2023年9月25日 22:25

At Acustom Boxes, we go beyond just providing boxes. We offer various packaging options and services to meet your diverse needs.

Avatar_small
Sajedul Blogger 说:
2023年11月02日 23:41

The article on "The simplest jQuery File Upload example based on Python" is a fantastic resource for anyone looking to add file upload functionality to their web application using jQuery and Python. It provides a clear and easy-to-follow example, making it accessible even to those with limited coding experience. The combination of jQuery and Python is a powerful one, and this tutorial simplifies the process, making it a valuable guide for developers at all levels. Whether you're a beginner or an experienced developer, this tutorial is sure to help you implement file uploads with ease. Great job! <a href="https://sajedulblogger.blogspot.com/">Sajedul Blogger</a>

Avatar_small
Sajedul Blogger 说:
2023年11月02日 23:47

"The simplest jQuery File Upload example based on Python" is an excellent resource for web developers seeking a straightforward and effective way to implement file upload functionality in their projects. This tutorial provides a step-by-step guide that's easy to follow, making it accessible to developers of all skill levels. By combining the power of jQuery and Python, it simplifies what can often be a complex task, allowing developers to achieve file uploads efficiently. Whether you're a novice or an experienced coder, this tutorial is a valuable resource that will streamline the process of adding file upload capabilities to your web applications. Kudos to the author for providing such a helpful and well-explained example! <a href="https://aaaguestposting.blogspot.com/">AAA Best Guest Posting Services</a> and <a href="https://aaaguestposting.blogspot.com/">Blogger Outreach Services</a>

Avatar_small
Sajedul Blogger 说:
2023年11月02日 23:52

"The simplest jQuery File Upload example based on Python" is an invaluable guide for web developers looking to incorporate file uploading functionality into their projects. This tutorial offers a user-friendly, step-by-step approach, ensuring accessibility for developers of all experience levels. By harnessing the combined power of jQuery and Python, it simplifies a typically intricate task, facilitating efficient file uploads. Whether you're a newcomer or a seasoned developer, this tutorial proves to be an indispensable resource, simplifying the process of integrating file upload features into your web applications. The author deserves praise for providing a well-documented and highly informative example. AA Best Guest Posting Services and Blogger Outreach Services

Avatar_small
Sajedul Blogger 说:
2023年11月02日 23:56

<p>"The simplest jQuery File Upload example based on Python" is a superb tutorial for developers seeking a straightforward and effective way to implement file upload functionality in their web applications. The step-by-step guidance in this article is easy to follow, making it accessible to developers of all skill levels. By leveraging the combination of jQuery and Python, it simplifies a potentially complex task, enabling developers to achieve efficient file uploads with ease. Whether you're a beginner or an experienced coder, this tutorial is a valuable resource that streamlines the process of adding file upload capabilities to your web projects. Kudos to the author for delivering such a well-explained and helpful example!&nbsp;<a href="https://aguestposting.blogspot.com/" target="_blank">A Best Guest Posting Services</a>&nbsp;and&nbsp;<a href="https://aguestposting.blogspot.com/" target="_blank">Blogger Outreach Services</a></p>

Avatar_small
civaget 说:
2023年12月03日 01:21

백링크업체's SEO audits are worth every penny. They transformed my website's search engine performance.

Avatar_small
SEO 说:
2023年12月03日 14:31

When it comes to 안전놀이터 추천, Toto Match stands out with its commitment to user security and fairness in gaming.

Avatar_small
civaget 说:
2023年12月06日 04:48

오피스타's extensive coverage ensures I never miss an exciting OP spot in my area.

Avatar_small
civaget 说:
2023年12月09日 22:09

Multilingual managers at 제주출장마사지 ensure effective communication and a seamless massage experience. I highly recommend their services.

Avatar_small
civaget 说:
2023年12月09日 22:46

When in Busan, don't miss out on 부산오피. It's a key part of the city's vibrant nightlife.

Avatar_small
civaget 说:
2023年12月12日 19:09

Oga's 출장마사지 is a rejuvenating experience. Their therapists are skilled, and the convenience is unparalleled.

Avatar_small
civaget 说:
2023年12月12日 21:18

Impressive variety of sports on 스포츠중계. No need to search elsewhere for live matches. It's all here!

Avatar_small
civaget 说:
2023年12月12日 22:14

As a sports community, 무료스포츠중계 brings fans together. I love discussing games and connecting with fellow enthusiasts.

Avatar_small
civaget 说:
2023年12月14日 16:55

Blogs ou should be reading… [...]Here is a Great Blog You Might Find Interesting that we Encourage You[...]…… 에볼루션카지노

Avatar_small
civaget 说:
2023年12月15日 00:06

Excellent post. I was checking constantly this blog and I am impressed! Extremely useful information particularly the last part I care for such information a lot. I was seeking this certain info for a long time. Thank you and best of luck. NBA중계

Avatar_small
civaget 说:
2023年12月19日 19:50

The absence of subscription fees on 누누티비 makes it a cost-effective choice.

Avatar_small
civaget 说:
2023年12月27日 04:44

Self-published authors can use analytics to identify and target specific reader demographics. amazon self publishing

Avatar_small
civaget 说:
2024年1月07日 23:32

olive oil is very very tasty if you put it in fried foods and you can taste it raw too. google doc dark mode

Avatar_small
seo service london 说:
2024年1月13日 20:33

Casual Shoes Collection. Add extraordinary style to your everyday excursions when you wear Best Mens Casual Shoes

Avatar_small
civaget 说:
2024年1月15日 16:06

For those who have thyroid issues then you could know that this gland generates hormones within the body. When your body just isn’t capable to generate these hormones in the manner that it should it trigger imbalances within the body that may lead to the excessive production of moles. เว็บบอลคืนยอดเสีย

Avatar_small
best pc games 2024 说:
2024年1月20日 17:11

Good day, i am doing research right now and your blog really helped me,

Avatar_small
alinajoy 说:
2024年1月23日 04:11

Impressive! This could be one of the most beneficial blogs I've encountered on this subject. It's often a challenge to find individuals well-versed in this topic, but you seem to know exactly what you're talking about! Thanks.

Avatar_small
james 说:
2024年1月23日 15:18

Just wanna comment that you have a very nice site, I the style and design it actually stands out. The Presidential Family

Avatar_small
civaget 说:
2024年1月25日 04:05 I like your website.. excellent colorations & topic. Do anyone pattern this website you or perhaps did you actually hire an attorney to get it done for yourself? Plz interact since I!|m seeking to pattern my own site in addition to would wish to learn where u became this kind of by. appreciate it 화장품회사
Avatar_small
SEO 说:
2024年1月27日 15:27

I just couldn’t depart your site prior to suggesting that I extremely enjoyed the standard information an individual provide for your visitors? Is gonna be back frequently in order to inspect new posts Auto CAD 2012 Product Key

Avatar_small
SEO 说:
2024年1月29日 21:39 Aw, it was a very good post. In idea I would like to devote writing such as this furthermore,?¡ìC spending time and specific work to produce a great article?- nonetheless so what can I say?- I waste time alot and never at all seem to obtain one thing completed. Colorado Driver License
Avatar_small
SEO 说:
2024年1月29日 21:50

Hey There. I found your blog using msn. This is a very well written article. I will be sure to bookmark it and return to read more of your useful information. Thanks for the post. I will definitely return. FakeIDVendors

Avatar_small
SEO 说:
2024年1月29日 21:59

What i don’t realize is in fact how you’re no longer actually much more smartly-liked than you may be right now. You are very intelligent. You understand thus significantly on the subject of this matter, produced me for my part imagine it from so many various angles. Its like men and women are not involved unless it is something to do with Lady gaga! Your personal stuffs nice. Always maintain it up! oldironsides

Avatar_small
SEO 说:
2024年1月29日 22:07

 such a perfect way? I have a presentation that I am presently working on, and I have been on the look out for such information. Buy Scannable ID

Avatar_small
SEO 说:
2024年1月29日 22:17

I have recently started a blog, the info you provide on this site has helped me greatly. Thanks for all of your time & work. Scannable Fake IDS

Avatar_small
SEO 说:
2024年1月29日 22:33

Thanks for sharing, this is a fantastic article post. Really Cool. HOW TO GET A FAKE ID

Avatar_small
SEO 说:
2024年1月29日 22:43

When visiting blogs, i usually discover a very good content like yours OldIronSides

Avatar_small
SEO 说:
2024年1月29日 22:53

Hey, you?re the goto expert. Thanks for haingng out here. Dingo Fakes ids

Hey, you?re the goto expert. Thanks for haingng out here. Dingo Fakes ids

Avatar_small
SEO 说:
2024年1月29日 23:03

hello!,I really like your writing so a lot! percentage we keep up a correspondence extra about your article on AOL? I require an expert on this area to unravel my problem. Maybe that's you! Taking a look ahead to look you. Buy scannable Fake ID

Avatar_small
SEO 说:
2024年2月01日 13:06

How is it that just anyone can publish a blog and get as popular as this? Its not like youve said something incredibly impressive –more like youve painted a quite picture above an issue that you know nothing about! I dont want to sound mean, right here. But do you definitely think that you can get away with adding some quite pictures and not really say anything? what is sky signature

Avatar_small
how to change group 说:
2024年2月01日 18:11

Why didnt I think about this? I hear exactly what youre saying and Im so happy that I came across your blog. You really know what youre talking about, and you made me feel like I should learn more about this. Thanks for this; Im officially a huge fan of your blog

Avatar_small
seo 说:
2024年2月03日 03:33

Glad to be one of the visitors on this awe inspiring web site : D. Tonic Greens Reviews

Avatar_small
SEO 说:
2024年2月04日 14:38

This web site is usually a walk-through its the data you wished concerning this and didn’t know who ought to. Glimpse here, and you’ll definitely discover it. Büyükçekmece Escort

Avatar_small
꽁머니 说:
2024年2月04日 23:18

Discover the magic of 꽁머니 on Toto sites. It's your ticket to an unforgettable gaming experience!

Avatar_small
꽁머니 说:
2024年2月05日 12:22

When it comes to cosmetics, اموس is my top choice. High-quality and diverse products that suit everyone.

Avatar_small
SEO 说:
2024年2月05日 18:06

Hello there, You have done a fantastic job. I’ll definitely digg it and for my part recommend to my friends. I am confident they will be benefited from this website. wood and co

Avatar_small
툰코 무협 说:
2024年2月06日 12:32

I'm forever grateful for 툰코 무협 for providing endless entertainment.

Avatar_small
툰코 무협 说:
2024年2月06日 12:58 툰코웹툰's quality is top-notch. The images are clear, and the stories are captivating.
Avatar_small
How to Pay Someone w 说:
2024年2月07日 17:51

Personally, I have found that to remain probably the most fascinating topics when it draws a parallel to.

Avatar_small
seo 说:
2024年2月11日 14:34

I was reading some of your content on this website and I conceive this internet site is really informative ! Keep on putting up. 셔츠룸

Avatar_small
civaget704 说:
2024年2月11日 23:42

Offices of education find relief in Timely GPT's automation for 기간제교사.

Avatar_small
툰코 단행본 说:
2024年2月13日 21:06

The versatility of genres on 툰코 웹툰 keeps my reading experience fresh and exciting.

Avatar_small
หนังจีน 说:
2024年2月17日 16:23

I have been meaning to read this and just never obtained a chance. It’s an issue that I’m really interested in, I just started reading and I’m glad I did. You’re a fantastic blogger, one of the best that I’ve seen. This weblog undoubtedly has some facts on topic that I just wasn’t aware of. Thanks for bringing this stuff to light.

Avatar_small
툰코 일진녀 길들이기 说:
2024年2月18日 00:47 I recommend 열혈강호 툰코 to all martial arts enthusiasts. It's a masterpiece.
Avatar_small
여성전용마사지 说:
2024年2月21日 03:53

I'm a devoted fan of 토닥이. Their edge therapy is life-changing.

Avatar_small
먹튀폴리스 说:
2024年2月23日 23:12

Hmm it appears like your website ate my first comment (it was super long) so I guess I'll just sum it up what I had written and say, I'm thoroughly enjoying your blog. I as well am an aspiring blog blogger but I'm still new to everything. Do you have any points for novice blog writers? I'd certainly appreciate it. 먹튀폴리스

Avatar_small
simon 说:
2024年2月27日 12:26

cooking is my passion and a hobby for me, besides, i love to eat lots of foods,. <a href="https://www.newtokki.org/">뉴토끼</a>

Avatar_small
sar 说:
2024年3月02日 13:05

Hey I was just looking at your site in Firefox and the image at the top of the link cant show up correctly. Just thought I would let you know. https://888b.charity/

Avatar_small
소액결제 현금화 说:
2024年3月02日 23:17

상품권 현금화 makes it effortless to unlock the value of your gift cards.q

Avatar_small
sar 说:
2024年3月03日 16:25

very good post, i definitely love this excellent website, keep on it 먹튀검증사이트

Avatar_small
sar 说:
2024年3月03日 17:08

wow, can’t believe how fast times past by, can’t believe it’s friday once again and that means, friday beer night with friends, he he 먹튀검증사이트

Avatar_small
sar 说:
2024年3月03日 17:24

I your writing style truly enjoying this internet site . 먹튀검증사이트

Avatar_small
sar 说:
2024年3月04日 13:56

I love meeting utile info, this post has got me even more info! . heraklion weed


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter