I must upload some files from form to cloud server without redirecting there. So I have found this tutorial with php/ajax but a function that's not contained in django can be used there -
move_submitted_file. How do i attain the same goes with django ? Presently I am using part of django-filetransfers, but after posting my make up the whole part after
if request.method == Publish is overlooked :
def upload_handler(request): if request.method == 'POST': form = ArtifactSubmissionForm(request.Publish, request.FILES) if form.is_valid(): form.save() return HttpResponseRedirect('/') else: upload_url, upload_data = prepare_upload(request, "uploadlink") form = ArtifactSubmissionForm() myfileid = create_myfileid() return direct_to_template(request, 'rte/artifact_inline.html', distribution)
and also the html:
<h1>Submit</h1> <form action="" method="Publish" enctype="multipart/form-data"> <table></table> <p> <input type="hidden" maxlength="64" title="myfileid" value="" > </p> <p> <input type="submit" value="Submit" /> </p> </form>
I simply need to send files to server for more processing after which read their web addresses from servers response. Don't have to rely on them as File objects.
The django-storages plug-in has features that enables you to definitely instantly store submitted content towards the repository of your liking. We have an annoying have to be associated with your MEDIA_URL, but that is just code and you will deal with it.
Source code are available here: Django storages.
I suggest rooting round the network for just one that you want. If you are using Amazon . com Cloudfront, when i do inside my present position, using one which disabls HTTPS over signed Web addresses saved us a couple of millicents per download, which does accumulate with time.