google app engine - upload image to folder using python -


I want to browse the image; Upload it to folder using python I have tried various solutions posted on the forum, but none of them works in my case. Please guide me to who needs to be corrected. Thanks for your quick help.

I'm getting the error

Attribute Enter attribute: is_key

  #! / Usr / bin / nv python import CGI, OS import CGITB; cgitb.enable () import cgi import datetime import webapp2 import cgi, os import cgitb; google.appengine.ext Import NDB to google.appengine.api import user guestbook_key = ndb.Key ('Guestbook', 'default_guestbook') class greeting (ndb.model): author = ndb.UserProperty () content = ndb.TextProperty ( ) Date = ndb.DateTimeProperty (auto_now_add = true) class home page (webapp2.RequestHandler): def find (auto): self.response.out.write ('& lt; html & gt; & lt; body & gt;' Congratulations = ndb.gql ('Select "from' Greeting '' Where is the Asselar: 1 '' According to the DESC limit order '10, Guestbook_Ki) Greetings: If greeting. Author: self.response.out.write '& lt; B & gt;% s & lt; / B & gt; Has written: 'greeting.author.nickname ()) Other: self.response.out.write (' An anonymous person wrote: ') self.response.out.write (' 'block' gt; s & lt; / blockquote>% cgi.escape (greeting content) self.response.out.write ("" "form enctype =" multipart / form-data "action =" / sign "input = "Post" & gt; & lt; p & gt; File: & lt; input type = "file" name = "file1">  

& lt; / l & gt; & lt; p & gt; ; Input Type = "Submit" value = "" & Gt Upload; & lt; / Form & gt; & lt; / html & gt; "" ") Class Guestbook (webapp2.RequestHandler ): def post (self): form = cgi.FieldStorage () #Nested fieldStorage installation File #file = models.FileField (upload_to = 'documents /', max_length = 5234, empty = true, tap = true) # docfile = forms.FileField (label = '', show_hidden_initial = 'none', required = true ), fileitem = str (self.request.get ('file1')) # If the file was uploaded then self.request.has_key ('file1'): # Strip the main path by the name of the file to avoid the directory, the trustsel Open the attacks fn = os.path.basename (fileitem.file) ('files /' + fn, 'wb'). Compose (fileitem.file.read ()) message = 'file' '+ + fn +' was successfully uploaded 'and: message =' no file uploaded 'print' \ content-type: text / html \ n & lt; html & gt; & lt; body & gt; & lt; p & gt;% s & lt; / p & gt; & lt; / body & gt; & lt; / html & gt; ""% (Message) app = webpage 2. SSGIAPCirmation ([('/', main page), ('/ sign', guestbook)], debug = truus

You have to stop here and go back and read the introductory document on appengine and dragon runtime. If you read through the introduction documents, you will see the section on Dragon Runtime and Sandbox and its restrictions. / P>

On examining that section of the document, you will see that you have phyllosis in epinegon You can not write the system, but also when you keep other restrictions in mind.

Where the code is your error, you should include at least one stacktrace and the special lines of code You should see where the error occurs and instead of asking specific questions about it, all the dumps is saying more about your code than what you got.

At the moment I see the problem of your code There are not many points where there is a is_key error, the error is the self explanation, the ore and whatever else you are trying to do will not work anyway.

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -