def upload(): if request.method == 'POST': title = request.form['document_title'] doc_id = pdforg.save_document(title, request.files['document_data']) if doc_id: #return redirect(url_for('document', doc_id=doc_id)) return redirect(url_for('index')) else: upload_error() else: return render_template('upload.jinja2.html', page_upload="active")
def scan_dir(): if request.method == 'POST': path = request.form['src_path'] doc_ids = [] for glob_path in glob.glob(os.path.expanduser(path)): for root, _, files in os.walk(glob_path): for name in files: srcFilePath = os.path.join(root,name) print srcFilePath doc_ids.append(pdforg.save_document("", FilesystemFile(srcFilePath))) if doc_ids: return redirect(url_for('index')) else: upload_error() else: return render_template('upload.jinja2.html', page_upload="active")
def scan_dir(): if request.method == 'POST': path = request.form['src_path'] doc_ids = [] for glob_path in glob.glob(os.path.expanduser(path)): for root, _, files in os.walk(glob_path): for name in files: srcFilePath = os.path.join(root, name) print srcFilePath doc_ids.append( pdforg.save_document("", FilesystemFile(srcFilePath))) if doc_ids: return redirect(url_for('index')) else: upload_error() else: return render_template('upload.jinja2.html', page_upload="active")