<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; color: rgb(0, 0, 0); font-size: 14px; font-family: Calibri, sans-serif;"><div><div><div>Hi Dmitry</div><div><br></div><div>I can upload smaller files – it is when the file is above 130k that the problem occurs.</div><div><br></div><div><div>def fnGetFileArea(cDestination):</div><div> cFileList = ''</div><div> if sys.platform == 'darwin':</div><div> cDestination = "/Volumes/documents"</div><div> session['platform'] = 'mac'</div><div> elif sys.platform == 'win32':</div><div> session['platform'] = 'win32'</div><div> cDestination = "p:\\"</div><div> return(cDestination) </div></div><div><br></div><div><div>@app.route('/docget',methods=['GET','POST'])</div><div>def docget():</div><div> cDocType = ''</div><div> cDestination = ''</div><div> aDocs = []</div><div> cFileList = []</div><div> srv = ''</div><div> if request.method == 'POST':</div><div> cDestination = fnGetFileArea(cDestination)</div><div> cUser = request.args.get('user')</div><div> cUserType = request.args.get('usertype')</div><div> cDocType = request.form['doctype']</div><div> session['user'] = cUser</div><div> if 'attach' in request.files: </div><div> file = request.files['attach']</div><div> filename = file.filename</div><div> if filename != '':</div><div> filename = filename.replace(' ','_')</div><div> if session['platform'] == 'mac':</div><div> cFileSaveArea = cUserType + '/' + cDocType</div><div> destination = '/'.join([cDestination+'/'+cFileSaveArea,filename])</div><div> cDestination = cDestination + '/' + cUserType</div><div> elif session['platform'] == 'win32':</div><div> cFileSaveArea = cUserType + '\\' + cDocType</div><div> destination = '\\'.join([cDestination+cFileSaveArea,filename])</div><div> cDestination = cDestination + '\\' + cUserType</div><div> try: </div><div> cError = file.save(destination) </div><div> except:</div><div> flash('could not save')</div><div> cFileList = os.listdir(cDestination)</div><div> return render_template('selectdoc.html',user=cUser,usertype=cUserType,aDocs=cFileList)</div><div> else:</div><div> cDestination = fnGetFileArea(cDestination)</div><div> if 'user' in request.args:</div><div> cUser = request.args.get('user')</div><div> session['user'] = cUser</div><div> if 'usertype' in request.args:</div><div> cUserType = request.args.get('usertype')</div><div> if session['platform'] == 'mac':</div><div> cDestination = cDestination + '/' + cUserType</div><div> if session['platform'] == 'win32':</div><div> cDestination = cDestination + '\\' + cUserType</div><div> cFileList = os.listdir(cDestination)</div><div> if cUser .strip() != '' and cUserType.strip() != '':</div><div> return render_template('selectdoc.html',user=cUser,usertype=cUserType,aDocs=cFileList)</div></div><div><br></div><div>Have tested on my windows apache server and small files are uploaded but large files fail.</div><div><br></div><div>Regards</div><div><br></div><div>Colin</div><div><br></div><div><br></div><div><div id="MAC_OUTLOOK_SIGNATURE"></div></div></div></div><div><br></div><span id="OLK_SRC_BODY_SECTION"><div style="font-family:Calibri; font-size:12pt; text-align:left; color:black; BORDER-BOTTOM: medium none; BORDER-LEFT: medium none; PADDING-BOTTOM: 0in; PADDING-LEFT: 0in; PADDING-RIGHT: 0in; BORDER-TOP: #b5c4df 1pt solid; BORDER-RIGHT: medium none; PADDING-TOP: 3pt"><span style="font-weight:bold">From: </span> Flask <<a href="mailto:flask-bounces+colin=techdata.net.au@python.org">flask-bounces+colin=techdata.net.au@python.org</a>> on behalf of Dmitry <<a href="mailto:d@ddipp.net">d@ddipp.net</a>><br><span style="font-weight:bold">Date: </span> Tuesday, 15 November 2016 at 2:48 pm<br><span style="font-weight:bold">To: </span> <<a href="mailto:flask@python.org">flask@python.org</a>><br><span style="font-weight:bold">Subject: </span> Re: [Flask] File Upload<br></div><div><br></div><div>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
<div text="#000000" bgcolor="#FFFFFF">
<p><span id="result_box" class="" lang="en"><span>Check the</span> <span>write
permissions</span> <span>on the</span> <span>folder in which
you</span> <span>save the file</span><span>.</span><br>
<span>When</span> <span>downloading a file</span> <span>passes</span>
<span>100</span><span>% and</span> <span>then</span> <span>there
is an error</span><span>, then perhaps</span> <span>it is not
connected</span> <span>with the limitation</span> <span>on</span>
<span>size</span><span>.</span><br>
<span class="">Or show</span> <span class="">code</span> <span class="">that allows</span> <span class="">to upload files to</span>
<span class="">the server</span><span class="">.</span></span></p>
<br>
<div class="moz-cite-prefix">15.11.2016 11:33, Colin Haig пишет:<br>
</div>
<blockquote cite="mid:00784859-CE83-48AB-8FBB-4A715BA2B6BE@techdata.net.au" type="cite">
<div>
<div>
<div><br>
</div>
</div>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div><br>
</div>
<div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space;
-webkit-line-break: after-white-space; color: rgb(0, 0, 0);
font-size: 14px; font-family: Calibri, sans-serif;">
<div>To All </div>
<div><br>
</div>
<div>I am trying to upload a file using flask – but when I
upload a large file I get a server error.</div>
<div><br>
</div>
<div>I have tried the following :</div>
<div><br>
</div>
<div>
<div>app.config['MAX_CONTENT_LENGTH'] = 16 * 1024 * 1024</div>
</div>
<div>When I reduce the above setting Flask reports a 413
error which is is supposed to do</div>
<div><br>
</div>
<div><br>
</div>
<div>Updated apache server</div>
<div><br>
</div>
<div>Have added LimitRequestBody 0 to my http.conf</div>
<div><br>
</div>
<div>If I upload the file though my locahost flask server
there are no issues.</div>
<div><br>
</div>
<div><br>
</div>
<div>When I submit the file upload I can see a counter
counting up to 100% but then it crashes with a server
error – I have</div>
<div>checked the apache logs but can not see any error
associated with the upload.</div>
<div><br>
</div>
<div>I have searched the web looking for answers but to no
avail.</div>
<div><br>
</div>
<div>Any help greatly appreciated.</div>
<div><br>
</div>
<div>Regards</div>
<div><br>
</div>
<div>Colin</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
</div>
</span>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Flask mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Flask@python.org">Flask@python.org</a><a class="moz-txt-link-freetext" href="https://mail.python.org/mailman/listinfo/flask">https://mail.python.org/mailman/listinfo/flask</a></pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Dmitry Podkovyrkin
email: <a class="moz-txt-link-abbreviated" href="mailto:d@ddipp.net">d@ddipp.net</a></pre>
</div></div>
_______________________________________________
Flask mailing list
<a href="mailto:Flask@python.org">Flask@python.org</a>
<a href="https://mail.python.org/mailman/listinfo/flask">https://mail.python.org/mailman/listinfo/flask</a>
</span></body></html>