views:

355

answers:

0

I am using the Yui Uploader 2.6.0 advanced example and apparently it is working fine on the client side. Basically the uploadAll function in javascript passes to the uploader the url containing the script to handle the uploaded file/s on the server:

function upload() {
if (fileList != null) {
 uploader.setSimUploadLimit(parseInt(document.getElementById("simulUploads").value));
 uploader.uploadAll("http://localhost:8080/sign2" );
}

On the server side the requestHander object (self) does not contain the variables Filename or Filedata (the default names to access the name and data of the files respectively). In essence I have tried the following but it does not retrieve anything, they are empty:

class ProcessOpinion2(webapp.RequestHandler):
  def post(self):

    f1 = self.request
    f2 = self.request.get('Filedata')
    f3 = self.request.get(u'Filedata')
    arg = self.request.arguments()   --> there is no arguments, arg is empty

When I debug the app, self.request contains the file uploaded:

Content-Length: 1457
Content-Type: multipart/form-data; boundary=----------ae0Ij5Ij5Ef1KM7Ij5Ij5KM7ei4gL6
Host: localhost:8080
User-Agent: Adobe Flash Player 9
X-Flash-Version: 9,0,124,0

------------ae0Ij5Ij5Ef1KM7Ij5Ij5KM7ei4gL6
Content-Disposition: form-data; name="Filename"

Help.JPG
------------ae0Ij5Ij5Ef1KM7Ij5Ij5KM7ei4gL6
Content-Disposition: form-data; name="Filedata"; filename="Help.JPG"
Content-Type: application/octet-stream

but once it executes f1 = self.request or f1 = self.request.get('Filedata') then f1 is empty and the self.request object is emptied (debug perspective):

Request: POST /sign2
Accept-Types: text/*
Connection: close
Content-Length: -1
Content-Type: multipart/form-data; boundary=----------Ij5GI3gL6gL6gL6KM7GI3KM7Ij5gL6
Host: localhost:8080
User-Agent: Adobe Flash Player 9
X-Flash-Version: 9,0,124,0

I have also observed that the upload data are contained in a unicode multidic in self.request.POST but I do not know how to retrieve this data or why they also disappears after executing self.request in the script.

Thanks in advance,