Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1103603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:21:56+00:00 2026-05-17T01:21:56+00:00

I don’t know why I can’t upload my file? When I hit submit instead

  • 0

I don’t know why I can’t upload my file? When I hit submit instead of redirecting to the default page (which is http://localhost:8082), it redirects to http://localhost:8082/sign. I didn’t build no such path, so it return link broken. Here’s my html:

<form action="/sign" enctype="multipart/form-data" method="post">
                <div><label>Excel file submit:</label></div>
                <div><input type="file" name="excel"/></div>
                <div><input type="submit" value="Upload file"></div>
            </form>

my app.yaml:

application: engineapp01
version: 1
runtime: python
api_version: 1

handlers:
- url: /js
  static_dir: js
- url: /css
  static_dir: css
- url: .*
  script: main.py

main.py:

import os;
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp import template
from google.appengine.ext import db
from mmap import mmap,ACCESS_READ
from xlrd import open_workbook

class Account(db.Model):
    name = db.StringProperty()
    type = db.StringProperty()
    no = db.IntegerProperty()
    co = db.IntegerProperty()

class MyFile(db.Model): 
    filedata = db.BlobProperty()

class MainHandler(webapp.RequestHandler):
    def get(self):
        #delete all old temporary entries
        query = Account.all()
        results = query.fetch(limit=40)
        db.delete(results)

        #temporary entry
        acc = Account(name='temporaryAccountName',
                    type='temporaryType',
                    no=0,
                    co=500)
        acc.put()
        temp = os.path.join(os.path.dirname(__file__),'templates/index.htm')

        tableData = ''
        query = Account.all()
        query.order('name')
        results = query.fetch(limit=20)
        for account in results:
            tempStr= """
                    <tr>
                        <td align='left' valign='top'>%s</td>
                        <td align='left' valign='top'>%s</td>
                        <td align='left' valign='top'>%d</td>
                        <td align='left' valign='top'>%d</td>
                    </tr>""" % (account.name,account.type,account.no,account.co)
            tableData = tableData + tempStr

        outstr = template.render(
                temp,
                {'tabledata':tableData})
        self.response.out.write(outstr)

    def post(self):
        myFile = MyFile()
        excel = self.request.get("excel")
        myFile.fileData = db.Blob(excel)
        myFile.put()
        self.redirect('/')

def main():
    application = webapp.WSGIApplication([('/', MainHandler)],
                                            debug=True)
    util.run_wsgi_app(application)


if __name__ == '__main__':
    main()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:21:56+00:00Added an answer on May 17, 2026 at 1:21 am

    Why are you sending the form data to a page that doesn’t exist?

    Try changing the HTML to:

    <form action="/" enctype="multipart/form-data" method="post">
    ...
    

    …since “/” is where your form-handling code resides.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Don't know if anyone can help me with this or if it's even possible.
Don't know why this doesn't work. I can't do implicit animation for a newly
I don't get to see the source code but the .class file. Can I
Don't know much about encryption... Say I'm preparing a SAML request to submit to
Don't know why I can't reply to people on here with only a small
Don't know why but I can't find a solution to this. I have 3
Don't know if it's stupid or reasonable question. I have methods which returns float/int
don't know if the title describes anything about what I'm trying to say but
don't know what happened in my jcrop selection. I think I pressed some keys
Don't really know how to formulate the title, but it should be pretty obvious

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.