コード例 #1
0
  def uploadPic():
    try:
      file = request.files['file']
      if allowed_file(file.filename):
	fileExtension = file.filename.rsplit('.', 1)[-1].lower()
	if request.args.get('type') == 'ProfilePic':
	  path = getpath('D_1')
	  file.save(os.path.join(path, 'ProfilePic'+ fileExtension))
	  updateSummaryProfile('D_1','ProfilePic',base+'Dealer/static/'+'D_1'+'/img/ProfilePic'+fileExtension)
	  return 'Uploaded'
	elif request.args.get('type') == 'CoverPic':
	  path = getpath('D_1')
	  file.save(os.path.join(path, 'CoverPic'+ fileExtension))
	  updateSummaryProfile('D_1','CoverPic',base+'Dealer/static/'+'D_1'+'/img/CoverPic'+fileExtension)
	  return 'Uploaded'
      return 'Unable to Upload'
    except Exception as e:
      return str(e)
コード例 #2
0
 def uploadPic():
     try:
         file = request.files['file']
         if allowed_file(file.filename):
             fileExtension = file.filename.rsplit('.', 1)[-1].lower()
             if request.args.get('type') == 'ProfilePic':
                 path = getpath('D_1')
                 file.save(os.path.join(path, 'ProfilePic' + fileExtension))
                 updateSummaryProfile(
                     'D_1', 'ProfilePic', base + 'Dealer/static/' + 'D_1' +
                     '/img/ProfilePic' + fileExtension)
                 return 'Uploaded'
             elif request.args.get('type') == 'CoverPic':
                 path = getpath('D_1')
                 file.save(os.path.join(path, 'CoverPic' + fileExtension))
                 updateSummaryProfile(
                     'D_1', 'CoverPic', base + 'Dealer/static/' + 'D_1' +
                     '/img/CoverPic' + fileExtension)
                 return 'Uploaded'
         return 'Unable to Upload'
     except Exception as e:
         return str(e)
コード例 #3
0
 def home():
     try:
         return getpath('D_1')
     except Exception as e:
         return str(e)
コード例 #4
0
 def home():
   try:
     return getpath('D_1')
   except Exception as e:
     return str(e)