yaniv-aknin / django-s3upload Goto Github PK
View Code? Open in Web Editor NEWSample django project utilizing jQuery File Upload to upload files directly to s3
License: The Unlicense
Sample django project utilizing jQuery File Upload to upload files directly to s3
License: The Unlicense
Hi,
I have followed all the instructions that is given in the readme and found that the server is running fine but while i upload anything ,it says "failed" as the status. Im somehow feeling that something is missing as input.... can you please throw me some light on this !
im doubting that there is some discrepency in the values that are passed in the html :
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Upload Demo</title>
<link rel="stylesheet" type="text/css" href="{% url static "index.css" %}">
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jqueryui/1.9.0/jquery-ui.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/coffee-script/1.3.3/coffee-script.min.js"></script>
<script type="text/javascript" src="{% url static "jquery.fileupload.js" %}"></script>
<script type="text/coffeescript">
log = (status) ->
$("#status").html status
$ ->
$("#upload_button").click ->
$("input[type=file]").click()
form = $("#upload_form")
form.fileupload
dataType: "xml"
add: (event, data) ->
log "fetching params"
$.get("{% url params %}").done (params) ->
form.find('input[name=key]').val(params.key)
form.find('input[name=policy]').val(params.policy)
form.find('input[name=signature]').val(params.signature)
data.submit()
send: (event, data) ->
log "sending"
progress: (event, data) ->
$("#progress_bar").css "width", "#{Math.round((event.loaded / event.total) * 1000) / 10}%"
fail: (event, data) ->
log "failure"
console.log event, data
done: (event, data) ->
log "file uploaded to " + decodeURIComponent $(data.result).find("Location").text()
</script>
</head>
<body>
<h1>Upload Demo</h1>
<div id="invisible">
<form action="{{ settings.AWS_S3_BUCKET_URL }}" method="post" enctype="multipart/form-data" id="upload_form">
<input type="hidden" name="key"></input>
<input type="hidden" name="AWSAccessKeyId" value="{{ settings.AWS_ACCESS_KEY_ID }}"></input>
<input type="hidden" name="acl" value="public-read"></input>
<input type="hidden" name="policy"></input>
<input type="hidden" name="signature"></input>
<input type="hidden" name="success_action_status" value="201"></input>
<input type="file" name="file"></input>
</form>
</div>
<div id="wrapper">
<img src="{% url static "upload_icon.png" %}" id="upload_button"/>
<div id="progress_container">
<div id="progress_bar"></div>
</div>
</div>
<div id="status_container">Status: <span id="status">idle</span></div>
</body>
</html>
I just wanted to say thank you for sharing :)
It gives me a direction how to start, however I need to have the files in the django database as well, so I have some more work to do :)
Hi,
its a long time I know. But I am facing 403 error when trying to upload anything to s3.
Does anything in the project needs to be changed?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.