Hello there,

Here at Microplan we have some trouble with the design of project we're 
currently workin on. It's some kind of company recruitation system, 
built on Flex 2, exchanging data with tomcat server application via 
webservices.  Main part of the system is the ability to fill CV form, 
providing data about yourself, as well as attaching photo and additional 
documents (certificates, etc). This is the place where problems starts 
to appear.  This is more of a design problem than Flex, perhaps, I don't 
know.  I'm sorry if the description might appear too detailed. I just 
would like to know the best approach. Perhaps it all can be narrowed to 
simple :
"how can I get the server response, after launching 
FileReference.upload() in Flex?"

Here is the scenario :

CV object  fields {
id : integer;
(... alot more here)
photoID : integer;
}

so in DB we have 'cv' table as well as 'attachments' table. The photoID 
in CV object points to the file (blob) in DB.

User sees available job positions. Her wants to apply for a specific 
position. He clicks the appropriate button, the CV form (new app state) 
pops in. New CV object is created with empty fields. User fills the 
form. User attaches own photo. He would like to see it on screen after 
it is uploaded.

How to achieve that?

 From what I've seen, Flex supports file upload/download only via 
FileReference.upload(URLRequest) method.  Fine. So I'm getting the 
FileReference handle to file on user disk. I cannot use the file 
(contents of file) just to display it on screen - flash security policy. 
So I have to upload it immediately to server, then somewhow get it back. 
So I have FileUpload servlet which takes the image stream and saves it 
to DB into 'attachments' table.  I also have FileDownload servlet which 
takes attachment id as a parameter, it searches for image in DB with 
that id, then spits it out. OK, so I'm launching 
FileReference.upload(url_to_my_servlet), the content is uploaded, the 
file is saved in DB.

The problem is that at this point I have no information about what 
happened with the file on serverside, and more important - i don't know 
the id that it was given to the new row (tuple) in the DB. Without that, 
I cannot display it for user. I also need it for the CV object, without 
it, I cannot save it to DB, when user will click "submit CV" button. The 
simplest, though maybe not most clean solution, would be to spit the ID 
to the servlet response stream in FileUpload , after the file has been 
saved to DB (and given the ID, so I have access to it) - however I'm 
unable to retrieve servlet result in Flex.

Apart from that, have you built applications that used files uploaded 
from users? How did you design that? What seems to be the best way?
I would be grateful for any help.

-- 
| Software Engineer
| Sebastian Zarzycki
| Microplan Polska (http://www.microplan.pl)



--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to