@app.route('/upload/', methods=['GET', 'POST'])
def render_upload():
    if (request.method == 'POST'):
        item = ''
        if ('--------' == request.form.get('storeItem')):
            redirected = redirect(url_for('render_upload'))
            flash('Please select store item.')
            return redirected
        elif ('Other' == request.form.get('storeItem')):
            item = request.form.get('Other')
        else:
            item = request.form.get('storeItem')
        if (None is request.form.get('radio')):
            redirected = redirect(url_for('render_upload'))
            flash('Please select an availability option.')
            return redirected
        if ('' == request.form.get('Name')):
            redirected = redirect(url_for('render_upload'))
            flash('Please enter a name.')
            return redirected
        if ('' == request.form.get('location')):
            redirected = redirect(url_for('render_upload'))
            flash('Please enter a location.')
            return redirected
        if ('' == request.form.get('store')):
            redirected = redirect(url_for('render_upload'))
            flash('Please enter a store.')
            return redirected
        if ('photo' not in request.files):
            redirected = redirect(url_for('render_upload'))
            flash('Please upload a photo.')
            return redirected
        file = request.files['photo']
        if ('' == file.filename):
            redirected = redirect(url_for('render_upload'))
            flash('No photo selected')
            return redirected
        locationStr = ((request.form.get('location') + '-') + request.form.get('store'))
        post = PostItem(name=request.form.get('Name'), storeItem=item, avalability=request.form.get('radio'), location=locationStr)
        db.session.add(post)
        db.session.commit()
        photo = request.files['photo']
        path = os.path.join(app.config['UPLOAD_FOLDER'], str(post.id))
        photo.save(path)
        print(((str(post.id) + post.storeItem) + post.avalability))
        return redirect(url_for('render_index'))
    return render_template('upload.html')
@app.route('/upload/', methods=['GET', 'POST'])
def render_upload():
    if (request.method == 'POST'):
        item = 
        if ('--------' == request.form.get('storeItem')):
            redirected = redirect(url_for('render_upload'))
            flash('Please select store item.')
            return redirected
        elif ('Other' == request.form.get('storeItem')):
            item = request.form.get('Other')
        else:
            item = request.form.get('storeItem')
        if (None is request.form.get('radio')):
            redirected = redirect(url_for('render_upload'))
            flash('Please select an availability option.')
            return redirected
        if ( == request.form.get('Name')):
            redirected = redirect(url_for('render_upload'))
            flash('Please enter a name.')
            return redirected
        if ( == request.form.get('location')):
            redirected = redirect(url_for('render_upload'))
            flash('Please enter a location.')
            return redirected
        if ( == request.form.get('store')):
            redirected = redirect(url_for('render_upload'))
            flash('Please enter a store.')
            return redirected
        if ('photo' not in request.files):
            redirected = redirect(url_for('render_upload'))
            flash('Please upload a photo.')
            return redirected
        file = request.files['photo']
        if ( == file.filename):
            redirected = redirect(url_for('render_upload'))
            flash('No photo selected')
            return redirected
        locationStr = ((request.form.get('location') + '-') + request.form.get('store'))
        post = PostItem(name=request.form.get('Name'), storeItem=item, avalability=request.form.get('radio'), location=locationStr)
        db.session.add(post)
        db.session.commit()
        photo = request.files['photo']
        path = os.path.join(app.config['UPLOAD_FOLDER'], str(post.id))
        photo.save(path)
        print(((str(post.id) + post.storeItem) + post.avalability))
        return redirect(url_for('render_index'))
    return render_template('upload.html')