<div dir="ltr">Actually, disregard my question. I ended up using a AWS S3 bucket to host the images. I was able to convert the code in a matter of minutes, compared to the 2 days I wasted trying to get images uploaded into MySQL.</div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">Matt</div></div>
<br><div class="gmail_quote">On Wed, May 18, 2016 at 11:30 AM, Ioannis Pinakoulakis <span dir="ltr"><<a href="mailto:giannis.pin@gmail.com" target="_blank">giannis.pin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Matt,<br>
<br>
Firstly, I would like to mention that a better approach would be to not store the image in the database, rather a link that points to the each image probably in the file system. This will speed up your application, since 1) you query the database for less data, 2) reading from the file system is faster and finally 3) in case you want to move the images on a CDN or in general serve them from a separate server then this does not block you. Thus easier migrations.<br>
<br>
Back to your original problem. Do you get any error or something?<br>
<br>
Ioannis<br>
<div><div class="h5"><br>
18 maj 2016, 15:48, ο/η Matt Shields <<a href="mailto:matt@mattshields.org">matt@mattshields.org</a>> έγραψε:<br>
<br>
> I'm trying to get an image uploaded through a form and inserted into a Blob field in MySQL. This doesn't seem to work. What's wrong?<br>
><br>
> clientid = request.form['clientid']<br>
> file = request.files['logo']<br>
> path = config.app_path()<br>
> filename = "%s-logo.png" % clientid<br>
> local_file = "%s/static/%s" % (path, filename)<br>
> file.save(local_file)<br>
> sql = "UPDATE client SET logo = LOAD_FILE('%s') WHERE clientid = '%s'" % (local_file, clientid)<br>
> dbQuery(sql) #This is custom function to run a sql query.<br>
><br>
> Matt<br>
</div></div>> _______________________________________________<br>
> Flask mailing list<br>
> <a href="mailto:Flask@python.org">Flask@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/flask" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/flask</a><br>
</blockquote></div><br></div>