Sponge_2 0 Newbie Poster
images = [createProductForm.productImageModel.data, createProductForm.productImageModel.data]
            for image in images:
                if image.filename == '':
                    print('Image must have a filename')
                    return redirect(url_for('createProduct'))

                if not allowed_image(image.filename):
                    print('Image extension is not allowed')
                    return redirect(url_for('createProduct'))

                else:
                    filename = secure_filename(image.filename)
                    file_path = image.save(os.path.join(app.config['IMAGE_UPLOADS'], filename))
                    print(mysql.format(file_path))
                    mysql.connection.commit()
                    print("Hello yes!")
                print("images saved")

If i were to convert the image file to the file name, do i have to change the data type in mySQL to varchar instead of blob?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.