Upload file to server for encoding...
Hello Zope community, I just installed Zope-2.9.4 in a windows XP SP2 . I'm making a web site that the visitors should: A) Upload a file to the server B)After the file is uploaded , I have write a python program to encode the file C)When the encoding is finish, user must download the file back to his machine. I'm very new to Zope and I choose it because I thought it should have an easy and good communication with python. Since I have terminated the python program that does what I want, I have no idea how to accomplish the requests above. A -> I know I will need external access to the file system, is there a product that can help me in that ? B -> my program works as I want like a python program , it will need any modification so I can use it in Zope ? C -> I think I will need also some kind of progress indicator so the user can know when the encoding is done (some time takes more than a minute). Any ideas how the user will download back the file? should the download begin automatically after the encoding ? Thanks in advance...
----- Original Message ----- From: "Nick Gr" <skoupi@gmail.com> To: <zope@zope.org> Sent: Monday, September 11, 2006 8:08 AM Subject: [Zope] Upload file to server for encoding...
Hello Zope community,
I just installed Zope-2.9.4 in a windows XP SP2 . I'm making a web site that the visitors should:
A) Upload a file to the server
B)After the file is uploaded , I have write a python program to encode the file
C)When the encoding is finish, user must download the file back to his machine.
I'm very new to Zope and I choose it because I thought it should have an easy and good communication with python. Since I have terminated the python program that does what I want, I have no idea how to accomplish the requests above.
A -> I know I will need external access to the file system, is there a product that can help me in that ?
LocalFS and ExtFile are a couple of options.
B -> my program works as I want like a python program , it will need any modification so I can use it in Zope ?
Look into External Methods
C -> I think I will need also some kind of progress indicator so the user can know when the encoding is done (some time takes more than a minute)
This may help: http://www.zope.org/Members/don/long_procces
. Any ideas how the user will download back the file? should the download begin automatically after the encoding ?
If your external method commits the transaction, a new zope object will be created. You could then do a response.redirect that causes the user's browser to access the new object. hth Jonathan
A) Upload a file to the server
B)After the file is uploaded , I have write a python program to encode the file
C)When the encoding is finish, user must download the file back to his machine.
I'm very new to Zope and I choose it because I thought it should have an easy and good communication with python. Since I have terminated the python program that does what I want, I have no idea how to accomplish the requests above.
A -> I know I will need external access to the file system, is there a product that can help me in that ?
LocalFS and ExtFile are a couple of options.
I try to install LocalFS with no success ( Zope never include it in the product list). Using ExtFile I just could have access to my file systems, how can I use it to upload a file from my website visitors pc ?
B -> my program works as I want like a python program , it will need any modification so I can use it in Zope ? Look into External Methods Already reading , thank's. C -> I think I will need also some kind of progress indicator so the user can know when the encoding is done (some time takes more than a minute) This may help:
http://www.zope.org/Members/don/long_procces That's a solution but do you know something more GUI like a progress bar ?
. Any ideas how the user will download back the file? should the download begin automatically after the encoding ? If your external method commits the transaction, a new zope object will be created. You could then do a response.redirect that causes the user's browser to access the new object.
My python program change the original file, it doesn't create another one after the encoding. Can I use the same Zope object or it doesn't work that way ? Cheers...
----- Original Message ----- From: "Nick Gr" <skoupi@gmail.com> To: "Jonathan" <dev101@magma.ca> Cc: <zope@zope.org> Sent: Monday, September 11, 2006 10:14 AM Subject: Re: [Zope] Upload file to server for encoding...
Using ExtFile I just could have access to my file systems, how can I use it to upload a file from my website visitors pc ?
You use an html form to get the user to specify which file they want to upload from their pc. Your form handler routine will receive a File upload object, here's some info on this: http://www.zope.org/Members/Benno/FileUpload
C -> I think I will need also some kind of progress indicator so the user can know when the encoding is done (some time takes more than a minute) This may help:
http://www.zope.org/Members/don/long_procces That's a solution but do you know something more GUI like a progress bar ?
Do a google search for: zope progess indicator
. Any ideas how the user will download back the file? should the download begin automatically after the encoding ? If your external method commits the transaction, a new zope object will be created. You could then do a response.redirect that causes the user's browser to access the new object.
My python program change the original file, it doesn't create another one after the encoding. Can I use the same Zope object or it doesn't work that way ?
If the changes have been committed to the zope object, then when the user accesses that object the user will see the changes (just make sure the cache control headers are set so that the original object does not get cached in the user's browser) Jonathan
Using ExtFile I just could have access to my file systems, how can I use it to upload a file from my website visitors pc ?
You use an html form to get the user to specify which file they want to upload from their pc. Your form handler routine will receive a File upload object, here's some info on this:
I just used this code to upload the file, but the file is uploaded in the Zope file system. If I want to use my python program for the encoding (or my python external method) , the file must be in my computer file system out of Zope right ?
C -> I think I will need also some kind of progress indicator so the user can know when the encoding is done (some time takes more than a minute) This may help:
http://www.zope.org/Members/don/long_procces That's a solution but do you know something more GUI like a progress bar ?
Do a google search for: zope progess indicator Working on it...
. Any ideas how the user will download back the file? should the download begin automatically after the encoding ? If your external method commits the transaction, a new zope object will be created. You could then do a response.redirect that causes the user's browser to access the new object.
My python program change the original file, it doesn't create another one after the encoding. Can I use the same Zope object or it doesn't work that way ?
If the changes have been committed to the zope object, then when the user accesses that object the user will see the changes (just make sure the cache control headers are set so that the original object does not get cached in the user's browser)
Can't follow you on this one clearly... I think if I can accomplish the previous tasks I should be able to do something with that. Thank you Jonathan ;-)
----- Original Message ----- From: "Nick Gr" <skoupi@gmail.com> To: "Jonathan" <dev101@magma.ca> Cc: <zope@zope.org> Sent: Monday, September 11, 2006 10:46 AM Subject: Re: [Zope] Upload file to server for encoding...
. Any ideas how the user will download back the file? should the download begin automatically after the encoding ? If your external method commits the transaction, a new zope object will be created. You could then do a response.redirect that causes the user's browser to access the new object.
My python program change the original file, it doesn't create another one after the encoding. Can I use the same Zope object or it doesn't work that way ?
If the changes have been committed to the zope object, then when the user accesses that object the user will see the changes (just make sure the cache control headers are set so that the original object does not get cached in the user's browser)
Can't follow you on this one clearly... I think if I can accomplish the previous tasks I should be able to do something with that.
If your process is as follows: 1) User specifies a file to be uploaded (via an HTML form) 2) Your form handler (an external method) receives the File Upload Object and immediately processes the data (your encoding process) Then, after step 2, your external method can create a new zope object (which can be stored in the ZODB or on your server's file system - your choice) - your external method commits the transaction (which causes the new object to be 'persisted') - you then do a response.redirect which causes the user's browser to initiate a new http request to the url you specified in the response.redirect statement (this url will point to your new zope object). Jonathan
participants (2)
-
Jonathan -
Nick Gr