Hi,
>From document, I think it seems that Swazoo can support large sized file upload - for example, 10 GB or so - but I'm not sure how can I do this. How can I save the uploaded file during upload? Thanks in advance. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Swazoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swazoo-devel |
Hi S.J.Chun,
S.J.Chun wrote: >>From document, I think it seems that Swazoo can support large sized file > upload - for example, 10 GB or so - but I'm not sure how can I do this. Yes, Swazoo 2.x has streamed upload and download feature, able to transfer sustainable such big files. I tested few GB upload on both Squeak and VW. I suppose Swazoo on Gemstone is able too. > How can I save the uploaded file during upload? Basically you open target file in advance before actually receive upload request. From: http://www.swazoo.org/streaming.html : Defer request parsing until destination stream is known. Allows file upload directly from TCP socket to a file on a disk, without intermediate buffering of entire file in memory. Example We would like to save an uploaded file with the same name on local disk. Browser will send a file as a MIME part with name 'file'. Request content type will be multipart/form-data. Site>>answerTo: aHTTPRequest aHTTPRequest postDataAt: 'file' beforeStreamingDo: [:datum | datum writeStream: datum filename asFilename writeStream]. ^HTTPResponse ok aHTTPRequest postDataAt: aName beforeStreamingDo: aBlock sets a callback block, which will be called just before streaming begins and at that time it is a right moment to prepare a write stream on output file. Also, at that moment we already have a filename of original file (in a block argument 'datum'). Streaming will begin when we first access any other post data or when response is sent back. This is called a deferred parsing of post data until needed and allows us to prepare an output stream before post data is parsed. See also HTTPRequestTest with examples, how to use it (testing-posts). Streaming is otherwise fully supported in Aida/Web, so you can go there to see a working implementation. See FileProxy for download streaming and WebFileInputField class beforeStreamingDo: for upload. Upload is othervise used extensively in photo Gallery scriblet in forthcommng scribo for uploading large .zips of photos. Best regards Janko -- Janko Mivšek AIDA/Web Smalltalk Web Application Server http://www.aidaweb.si ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Swazoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swazoo-devel |
In reply to this post by Chun, Sungjin
I managed to create test application using your advice. But I found one problem. The
written file is not closed properly. After upload I cannot delete uploaded file at serverside or over write that file. And I'm using Squeak and I have to change my method as following; answerTo: aRequest | fileStream | fileStream _ FileStream fileNamed: 'design.html'. aRequest postDataAt: 'file' beforeStreamingDo: [ :datum | datum writeStream: (SpFilename named: datum filename) asFilename writeStream ]. ^ HTTPResponse ok entity: 'OK' How can I fix this problem? Thanks in advance. ----- Original Message ----- From: Janko Mivšek <[hidden email]> To: "S.J.Chun" <[hidden email]>, Swazoo Development Discussions <[hidden email]> Sent: 08-07-23 17:11:02 Subject: Re: [Swazoo-devel] [Q] Any example for Large file Upload? Hi S.J.Chun, S.J.Chun wrote: >>From document, I think it seems that Swazoo can support large sized file > upload - for example, 10 GB or so - but I'm not sure how can I do this. Yes, Swazoo 2.x has streamed upload and download feature, able to transfer sustainable such big files. I tested few GB upload on both Squeak and VW. I suppose Swazoo on Gemstone is able too. > How can I save the uploaded file during upload? Basically you open target file in advance before actually receive upload request. From: http://www.swazoo.org/streaming.html : Defer request parsing until destination stream is known. Allows file upload directly from TCP socket to a file on a disk, without intermediate buffering of entire file in memory. Example We would like to save an uploaded file with the same name on local disk. Browser will send a file as a MIME part with name 'file'. Request content type will be multipart/form-data. Site>>answerTo: aHTTPRequest aHTTPRequest postDataAt: 'file' beforeStreamingDo: [:datum | datum writeStream: datum filename asFilename writeStream]. ^HTTPResponse ok aHTTPRequest postDataAt: aName beforeStreamingDo: aBlock sets a callback block, which will be called just before streaming begins and at that time it is a right moment to prepare a write stream on output file. Also, at that moment we already have a filename of original file (in a block argument 'datum'). Streaming will begin when we first access any other post data or when response is sent back. This is called a deferred parsing of post data until needed and allows us to prepare an output stream before post data is parsed. See also HTTPRequestTest with examples, how to use it (testing-posts). Streaming is otherwise fully supported in Aida/Web, so you can go there to see a working implementation. See FileProxy for download streaming and WebFileInputField class beforeStreamingDo: for upload. Upload is othervise used extensively in photo Gallery scriblet in forthcommng scribo for uploading large .zips of photos. Best regards Janko -- Janko Mivšek AIDA/Web Smalltalk Web Application Server http://www.aidaweb.si ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Swazoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swazoo-devel |
In reply to this post by Chun, Sungjin
OOPS!!! just ignore "| fileStream |" and "fileStream _ ..." line :-)
----- Original Message ----- From: "S.J.Chun" <[hidden email]> To: "S.J.Chun" <[hidden email]>, Swazoo Development Discussions <[hidden email]>, Janko Mivšek <[hidden email]> Sent: 08-07-23 18:16:36 Subject: Re: Re: [Swazoo-devel] [Q] Any example for Large file Upload? I managed to create test application using your advice. But I found one problem. The written file is not closed properly. After upload I cannot delete uploaded file at serverside or over write that file. And I'm using Squeak and I have to change my method as following; answerTo: aRequest | fileStream | fileStream _ FileStream fileNamed: 'design.html'. aRequest postDataAt: 'file' beforeStreamingDo: [ :datum | datum writeStream: (SpFilename named: datum filename) asFilename writeStream ]. ^ HTTPResponse ok entity: 'OK' How can I fix this problem? Thanks in advance. ----- Original Message ----- From: Janko Mivšek <[hidden email]> To: "S.J.Chun" <[hidden email]>, Swazoo Development Discussions <[hidden email]> Sent: 08-07-23 17:11:02 Subject: Re: [Swazoo-devel] [Q] Any example for Large file Upload? Hi S.J.Chun, S.J.Chun wrote: >>From document, I think it seems that Swazoo can support large sized file > upload - for example, 10 GB or so - but I'm not sure how can I do this. Yes, Swazoo 2.x has streamed upload and download feature, able to transfer sustainable such big files. I tested few GB upload on both Squeak and VW. I suppose Swazoo on Gemstone is able too. > How can I save the uploaded file during upload? Basically you open target file in advance before actually receive upload request. From: http://www.swazoo.org/streaming.html : Defer request parsing until destination stream is known. Allows file upload directly from TCP socket to a file on a disk, without intermediate buffering of entire file in memory. Example We would like to save an uploaded file with the same name on local disk. Browser will send a file as a MIME part with name 'file'. Request content type will be multipart/form-data. Site>>answerTo: aHTTPRequest aHTTPRequest postDataAt: 'file' beforeStreamingDo: [:datum | datum writeStream: datum filename asFilename writeStream]. ^HTTPResponse ok aHTTPRequest postDataAt: aName beforeStreamingDo: aBlock sets a callback block, which will be called just before streaming begins and at that time it is a right moment to prepare a write stream on output file. Also, at that moment we already have a filename of original file (in a block argument 'datum'). Streaming will begin when we first access any other post data or when response is sent back. This is called a deferred parsing of post data until needed and allows us to prepare an output stream before post data is parsed. See also HTTPRequestTest with examples, how to use it (testing-posts). Streaming is otherwise fully supported in Aida/Web, so you can go there to see a working implementation. See FileProxy for download streaming and WebFileInputField class beforeStreamingDo: for upload. Upload is othervise used extensively in photo Gallery scriblet in forthcommng scribo for uploading large .zips of photos. Best regards Janko -- Janko Mivšek AIDA/Web Smalltalk Web Application Server http://www.aidaweb.si ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Swazoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swazoo-devel |
In reply to this post by Chun, Sungjin
S.J.Chun wrote:
> I managed to create test application using your advice. But I found one problem. The > written file is not closed properly. After upload I cannot delete uploaded file at serverside > or over write that file. And I'm using Squeak and I have to change my method as following; > > answerTo: aRequest > | fileStream | > fileStream _ FileStream fileNamed: 'design.html'. Why you need that fileStream? There is a correction needed on Squeak, yes, using SpFilename from Sport and opening it as (SpFilename named: 'file.name') instead 'file.name asFilename : Site>>answerTo: aHTTPRequest aHTTPRequest postDataAt: 'file' beforeStreamingDo: [:datum | datum writeStream: (SpFilename named: datum filename) writeStream]. ^HTTPResponse ok I corrected example on website too. JAnko -- Janko Mivšek AIDA/Web Smalltalk Web Application Server http://www.aidaweb.si ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Swazoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swazoo-devel |
Hi S.J.Chun,
I just studied that a bit more (well, my memory is so so :) Try this: Site>>answerTo: aHTTPRequest | stream | aHTTPRequest postDataAt: 'file' beforeStreamingDo: [:datum | stream := (SpFilename named: datum filename) writeStream. datum writeStream: stream]. aHTTPRequest ensureFullRead. "to be sure streaming occurs" stream close. "mandatory, to close open stream! " ^HTTPResponse ok Let me know if this works to update website again Janko Janko Mivšek wrote: > S.J.Chun wrote: >> I managed to create test application using your advice. But I found one problem. The >> written file is not closed properly. After upload I cannot delete uploaded file at serverside >> or over write that file. And I'm using Squeak and I have to change my method as following; >> >> answerTo: aRequest >> | fileStream | >> fileStream _ FileStream fileNamed: 'design.html'. > > Why you need that fileStream? > > There is a correction needed on Squeak, yes, using SpFilename from Sport > and opening it as (SpFilename named: 'file.name') instead 'file.name > asFilename : > > Site>>answerTo: aHTTPRequest > > aHTTPRequest > postDataAt: 'file' > beforeStreamingDo: [:datum | > datum writeStream: (SpFilename named: datum filename) writeStream]. > ^HTTPResponse ok > > I corrected example on website too. > > JAnko > -- Janko Mivšek Svetovalec za informatiko Eranova d.o.o. Ljubljana, Slovenija www.eranova.si tel: 01 514 22 55 faks: 01 514 22 56 gsm: 031 674 565 ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Swazoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swazoo-devel |
In reply to this post by Chun, Sungjin
Thank you, it works!
Not directly related to Swazoo but I found that if I test this in IE, the filename contains full path. In firefox, only file name contained. Thank you again. ----- Original Message ----- From: Janko Mivšek <[hidden email]> To: Swazoo Development Discussions <[hidden email]> Sent: 08-07-23 18:44:22 Subject: Re: [Swazoo-devel] [Q] Any example for Large file Upload? Hi S.J.Chun, I just studied that a bit more (well, my memory is so so :) Try this: Site>>answerTo: aHTTPRequest | stream | aHTTPRequest postDataAt: 'file' beforeStreamingDo: [:datum | stream := (SpFilename named: datum filename) writeStream. datum writeStream: stream]. aHTTPRequest ensureFullRead. "to be sure streaming occurs" stream close. "mandatory, to close open stream! " ^HTTPResponse ok Let me know if this works to update website again Janko Janko Mivšek wrote: > S.J.Chun wrote: >> I managed to create test application using your advice. But I found one problem. The >> written file is not closed properly. After upload I cannot delete uploaded file at serverside >> or over write that file. And I'm using Squeak and I have to change my method as following; >> >> answerTo: aRequest >> | fileStream | >> fileStream _ FileStream fileNamed: 'design.html'. > > Why you need that fileStream? > > There is a correction needed on Squeak, yes, using SpFilename from Sport > and opening it as (SpFilename named: 'file.name') instead 'file.name > asFilename : > > Site>>answerTo: aHTTPRequest > > aHTTPRequest > postDataAt: 'file' > beforeStreamingDo: [:datum | > datum writeStream: (SpFilename named: datum filename) writeStream]. > ^HTTPResponse ok > > I corrected example on website too. > > JAnko > -- Janko Mivšek Svetovalec za informatiko Eranova d.o.o. Ljubljana, Slovenija www.eranova.si tel: 01 514 22 55 faks: 01 514 22 56 gsm: 031 674 565 ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Swazoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swazoo-devel ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Swazoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swazoo-devel |
In reply to this post by Chun, Sungjin
Thank you, it works!
Not directly related to Swazoo but I found that if I test this in IE, the filename contains full path. In firefox, only file name contained. Thank you again. ----- Original Message ----- From: Janko Mivšek <[hidden email]> To: Swazoo Development Discussions <[hidden email]> Sent: 08-07-23 18:44:22 Subject: Re: [Swazoo-devel] [Q] Any example for Large file Upload? Hi S.J.Chun, I just studied that a bit more (well, my memory is so so :) Try this: Site>>answerTo: aHTTPRequest | stream | aHTTPRequest postDataAt: 'file' beforeStreamingDo: [:datum | stream := (SpFilename named: datum filename) writeStream. datum writeStream: stream]. aHTTPRequest ensureFullRead. "to be sure streaming occurs" stream close. "mandatory, to close open stream! " ^HTTPResponse ok Let me know if this works to update website again Janko Janko Mivšek wrote: > S.J.Chun wrote: >> I managed to create test application using your advice. But I found one problem. The >> written file is not closed properly. After upload I cannot delete uploaded file at serverside >> or over write that file. And I'm using Squeak and I have to change my method as following; >> >> answerTo: aRequest >> | fileStream | >> fileStream _ FileStream fileNamed: 'design.html'. > > Why you need that fileStream? > > There is a correction needed on Squeak, yes, using SpFilename from Sport > and opening it as (SpFilename named: 'file.name') instead 'file.name > asFilename : > > Site>>answerTo: aHTTPRequest > > aHTTPRequest > postDataAt: 'file' > beforeStreamingDo: [:datum | > datum writeStream: (SpFilename named: datum filename) writeStream]. > ^HTTPResponse ok > > I corrected example on website too. > > JAnko > -- Janko Mivšek Svetovalec za informatiko Eranova d.o.o. Ljubljana, Slovenija www.eranova.si tel: 01 514 22 55 faks: 01 514 22 56 gsm: 031 674 565 ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Swazoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swazoo-devel ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Swazoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swazoo-devel |
In reply to this post by Chun, Sungjin
S.J.Chun wrote:
> Thank you, it works! Nice to hear that! > > Not directly related to Swazoo but I found that if I test this in IE, the filename > contains full path. In firefox, only file name contained. Yes, the end web app needs to be aware of that. I just updated website, so now we have a working example there. Thanks for opening that question! Best regards Janko > > Thank you again. > > ----- Original Message ----- > From: Janko Mivšek <[hidden email]> > To: Swazoo Development Discussions <[hidden email]> > Sent: 08-07-23 18:44:22 > Subject: Re: [Swazoo-devel] [Q] Any example for Large file Upload? > > Hi S.J.Chun, > > I just studied that a bit more (well, my memory is so so :) > > Try this: > > Site>>answerTo: aHTTPRequest > | stream | > aHTTPRequest > postDataAt: 'file' > beforeStreamingDo: [:datum | > stream := (SpFilename named: datum filename) writeStream. > datum writeStream: stream]. > > aHTTPRequest ensureFullRead. "to be sure streaming occurs" > stream close. "mandatory, to close open stream! " > > ^HTTPResponse ok > > Let me know if this works to update website again > > > Janko > > > Janko Mivšek wrote: >> S.J.Chun wrote: >>> I managed to create test application using your advice. But I found one problem. The >>> written file is not closed properly. After upload I cannot delete uploaded file at serverside >>> or over write that file. And I'm using Squeak and I have to change my method as following; >>> >>> answerTo: aRequest >>> | fileStream | >>> fileStream _ FileStream fileNamed: 'design.html'. >> Why you need that fileStream? >> >> There is a correction needed on Squeak, yes, using SpFilename from Sport >> and opening it as (SpFilename named: 'file.name') instead 'file.name >> asFilename : >> >> Site>>answerTo: aHTTPRequest >> >> aHTTPRequest >> postDataAt: 'file' >> beforeStreamingDo: [:datum | >> datum writeStream: (SpFilename named: datum filename) writeStream]. >> ^HTTPResponse ok >> >> I corrected example on website too. >> >> JAnko >> > -- Janko Mivšek AIDA/Web Smalltalk Web Application Server http://www.aidaweb.si ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Swazoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swazoo-devel |
In reply to this post by Chun, Sungjin
To be sure, what I've tested was < 5 MB of size. For 500 MB iso, the system -
windows vista - was rather unusable. So, my decision on my original objective is squeak + swazoo might not be usable for it. ----- Original Message ----- From: Janko Mivšek <[hidden email]> To: "S.J.Chun" <[hidden email]>, Swazoo Development Discussions <[hidden email]> Sent: 08-07-23 22:08:07 Subject: Re: [Swazoo-devel] [Q] Any example for Large file Upload? S.J.Chun wrote: > Thank you, it works! Nice to hear that! > > Not directly related to Swazoo but I found that if I test this in IE, the filename > contains full path. In firefox, only file name contained. Yes, the end web app needs to be aware of that. I just updated website, so now we have a working example there. Thanks for opening that question! Best regards Janko > > Thank you again. > > ----- Original Message ----- > From: Janko Mivšek <[hidden email]> > To: Swazoo Development Discussions <[hidden email]> > Sent: 08-07-23 18:44:22 > Subject: Re: [Swazoo-devel] [Q] Any example for Large file Upload? > > Hi S.J.Chun, > > I just studied that a bit more (well, my memory is so so :) > > Try this: > > Site>>answerTo: aHTTPRequest > | stream | > aHTTPRequest > postDataAt: 'file' > beforeStreamingDo: [:datum | > stream := (SpFilename named: datum filename) writeStream. > datum writeStream: stream]. > > aHTTPRequest ensureFullRead. "to be sure streaming occurs" > stream close. "mandatory, to close open stream! " > > ^HTTPResponse ok > > Let me know if this works to update website again > > > Janko > > > Janko Mivšek wrote: >> S.J.Chun wrote: >>> I managed to create test application using your advice. But I found one problem. The >>> written file is not closed properly. After upload I cannot delete uploaded file at serverside >>> or over write that file. And I'm using Squeak and I have to change my method as following; >>> >>> answerTo: aRequest >>> | fileStream | >>> fileStream _ FileStream fileNamed: 'design.html'. >> Why you need that fileStream? >> >> There is a correction needed on Squeak, yes, using SpFilename from Sport >> and opening it as (SpFilename named: 'file.name') instead 'file.name >> asFilename : >> >> Site>>answerTo: aHTTPRequest >> >> aHTTPRequest >> postDataAt: 'file' >> beforeStreamingDo: [:datum | >> datum writeStream: (SpFilename named: datum filename) writeStream]. >> ^HTTPResponse ok >> >> I corrected example on website too. >> >> JAnko >> > -- Janko Mivšek AIDA/Web Smalltalk Web Application Server http://www.aidaweb.si ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Swazoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swazoo-devel |
In reply to this post by Chun, Sungjin
Because of this problem my next trial will be with gnu smalltalk. It seems that
Swazoo for gst be available, where can I find it? And do you think gst can handle this better? Thank you in advance. ----- Original Message ----- From: "S.J.Chun" <[hidden email]> To: Swazoo Development Discussions <[hidden email]>, Janko Mivšek <[hidden email]> Sent: 08-07-24 07:41:03 Subject: Re: Re: [Swazoo-devel] [Q] Any example for Large file Upload? To be sure, what I've tested was < 5 MB of size. For 500 MB iso, the system - windows vista - was rather unusable. So, my decision on my original objective is squeak + swazoo might not be usable for it. ----- Original Message ----- From: Janko Mivšek <[hidden email]> To: "S.J.Chun" <[hidden email]>, Swazoo Development Discussions <[hidden email]> Sent: 08-07-23 22:08:07 Subject: Re: [Swazoo-devel] [Q] Any example for Large file Upload? S.J.Chun wrote: > Thank you, it works! Nice to hear that! > > Not directly related to Swazoo but I found that if I test this in IE, the filename > contains full path. In firefox, only file name contained. Yes, the end web app needs to be aware of that. I just updated website, so now we have a working example there. Thanks for opening that question! Best regards Janko > > Thank you again. > > ----- Original Message ----- > From: Janko Mivšek <[hidden email]> > To: Swazoo Development Discussions <[hidden email]> > Sent: 08-07-23 18:44:22 > Subject: Re: [Swazoo-devel] [Q] Any example for Large file Upload? > > Hi S.J.Chun, > > I just studied that a bit more (well, my memory is so so :) > > Try this: > > Site>>answerTo: aHTTPRequest > | stream | > aHTTPRequest > postDataAt: 'file' > beforeStreamingDo: [:datum | > stream := (SpFilename named: datum filename) writeStream. > datum writeStream: stream]. > > aHTTPRequest ensureFullRead. "to be sure streaming occurs" > stream close. "mandatory, to close open stream! " > > ^HTTPResponse ok > > Let me know if this works to update website again > > > Janko > > > Janko Mivšek wrote: >> S.J.Chun wrote: >>> I managed to create test application using your advice. But I found one problem. The >>> written file is not closed properly. After upload I cannot delete uploaded file at serverside >>> or over write that file. And I'm using Squeak and I have to change my method as following; >>> >>> answerTo: aRequest >>> | fileStream | >>> fileStream _ FileStream fileNamed: 'design.html'. >> Why you need that fileStream? >> >> There is a correction needed on Squeak, yes, using SpFilename from Sport >> and opening it as (SpFilename named: 'file.name') instead 'file.name >> asFilename : >> >> Site>>answerTo: aHTTPRequest >> >> aHTTPRequest >> postDataAt: 'file' >> beforeStreamingDo: [:datum | >> datum writeStream: (SpFilename named: datum filename) writeStream]. >> ^HTTPResponse ok >> >> I corrected example on website too. >> >> JAnko >> > -- Janko Mivšek AIDA/Web Smalltalk Web Application Server http://www.aidaweb.si ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Swazoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swazoo-devel |
In reply to this post by Chun, Sungjin
S.J.Chun wrote:
> To be sure, what I've tested was < 5 MB of size. For 500 MB iso, the system - > windows vista - was rather unusable. So, my decision on my original objective > is squeak + swazoo might not be usable for it. I just checked to and you are right, large file upload is not optimized yet. It tooks 10min+ to upload 500MB .iso locally on VW while on Squeak I even didn't wait until end. My statements were probably from large file download side, where we are using Swazoo to stream large files like screencasts. Sorry for being unprecise. But I looked at the upload streaming code and see a lot of space for improvement. Current POST streaming parser is inefficient and generating a lot of garbage, which is from my experience from download side the biggest reason for bad performance. If I just have a bit time to optimize that too ... Maybe someone have a time? Look at methods: HTTPPost #readEntityFrom: aSwazooStream datum: aDatum boundary: aBoundaryBytes ... [bytes notNil] whileTrue: "if nil then we are on boundary" [bytes := self nextFrom: aSwazooStream boundary: aBoundaryBytes. bytes notNil ifTrue: [self nextPutAll: bytes to: queue afterTwoTo: outStream] ]. ... #nextFrom: aSwazooStream boundary: aBoundaryBytes #nextPut: byte to: aQueue afterTwoTo: aWriteStream Those methods are performance problematic, specially the above loop in first method. Problem is detecting the end of MIME part as efficient as possible. Without creating new objects and therefore a lot of garbage, and without copying byte by byte but block by block if possible. This technique helped me improve performance dramatically on downland streaming, so it can be reasonably expected to work in upload side too. Best regards Janko > > ----- Original Message ----- > From: Janko Mivšek <[hidden email]> > To: "S.J.Chun" <[hidden email]>, Swazoo Development Discussions <[hidden email]> > Sent: 08-07-23 22:08:07 > Subject: Re: [Swazoo-devel] [Q] Any example for Large file Upload? > > S.J.Chun wrote: >> Thank you, it works! > > Nice to hear that! >> Not directly related to Swazoo but I found that if I test this in IE, the filename >> contains full path. In firefox, only file name contained. > > Yes, the end web app needs to be aware of that. > > I just updated website, so now we have a working example there. Thanks > for opening that question! > > Best regards > Janko > >> Thank you again. >> >> ----- Original Message ----- >> From: Janko Mivšek <[hidden email]> >> To: Swazoo Development Discussions <[hidden email]> >> Sent: 08-07-23 18:44:22 >> Subject: Re: [Swazoo-devel] [Q] Any example for Large file Upload? >> >> Hi S.J.Chun, >> >> I just studied that a bit more (well, my memory is so so :) >> >> Try this: >> >> Site>>answerTo: aHTTPRequest >> | stream | >> aHTTPRequest >> postDataAt: 'file' >> beforeStreamingDo: [:datum | >> stream := (SpFilename named: datum filename) writeStream. >> datum writeStream: stream]. >> >> aHTTPRequest ensureFullRead. "to be sure streaming occurs" >> stream close. "mandatory, to close open stream! " >> >> ^HTTPResponse ok >> >> Let me know if this works to update website again >> >> >> Janko >> >> >> Janko Mivšek wrote: >>> S.J.Chun wrote: >>>> I managed to create test application using your advice. But I found one problem. The >>>> written file is not closed properly. After upload I cannot delete uploaded file at serverside >>>> or over write that file. And I'm using Squeak and I have to change my method as following; >>>> >>>> answerTo: aRequest >>>> | fileStream | >>>> fileStream _ FileStream fileNamed: 'design.html'. >>> Why you need that fileStream? >>> >>> There is a correction needed on Squeak, yes, using SpFilename from Sport >>> and opening it as (SpFilename named: 'file.name') instead 'file.name >>> asFilename : >>> >>> Site>>answerTo: aHTTPRequest >>> >>> aHTTPRequest >>> postDataAt: 'file' >>> beforeStreamingDo: [:datum | >>> datum writeStream: (SpFilename named: datum filename) writeStream]. >>> ^HTTPResponse ok >>> >>> I corrected example on website too. >>> >>> JAnko >>> > -- Janko Mivšek AIDA/Web Smalltalk Web Application Server http://www.aidaweb.si ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Swazoo-devel mailing list [hidden email] https://lists.sourceforge.net/lists/listinfo/swazoo-devel |
Free forum by Nabble | Edit this page |