Hi everybody, I am writing an intranet based on Seaside and I am struggling with a little problem. I need to record and serialize some data about files I use in my application. So I tried out with WAFile Class to make it more ergonomic for the future user but my pb is that : FIRST : I wrote this "html fileUploadWithCallback: [:f | file := f]" where f is an instance of WAFile class; but with this class instances you can get only 3 attributes which are - the contents (stream) - the fileName (just the filename string without the entire path) - the contentsType (text/plain, text/html ....) But me I NEED THE FULLPATH OF THE FILE.HOW CAN I GET IT ? SECOND : How could I create a WAFile class object using only the fullPath of a file ? Thank you for your help! Yahoo! Mail réinvente le mail ! Découvrez le nouveau Yahoo! Mail et son interface révolutionnaire. _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> But me I NEED THE FULLPATH OF THE FILE.HOW CAN I GET IT ?
You can't, basically because the standard disallows you to get the full path (otherwise that would be a big security leak). THere are still some old and buggy browser around, that provide the full path, but you can't count on that. > Thank you for your help! Pleas avoid HTML mails in the future. Cheers, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Lukas Renggli wrote:
>> But me I NEED THE FULLPATH OF THE FILE.HOW CAN I GET IT ? > > You can't, basically because the standard disallows you to get the > full path (otherwise that would be a big security leak). THere are > still some old and buggy browser around, that provide the full path, > but you can't count on that. I read that as the full path to the file on the server-side. For example, in PHP the file is uploaded to: $_FILES['userfile']['tmp_name'] and the original name (without path) would be in: $_FILES['userfile']['name']. Since you didn't mention anything about this Lukas, I'm guessing there is no file server-side with Seaside, just the data held in an object. If that's the case, then I guess you just open an output stream and write out the data to a file of your choosing William. > SECOND : How could I create a WAFile class object using only the fullPath of a file ? I guess you'd just set the content: to an opened file-stream. Any experienced smalltalkers know better? -- Richard Huxton Archonet Ltd _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
> > You can't, basically because the standard disallows you to get the
> > full path (otherwise that would be a big security leak). THere are > > still some old and buggy browser around, that provide the full path, > > but you can't count on that. > > I read that as the full path to the file on the server-side. For > example, in PHP the file is uploaded to: $_FILES['userfile']['tmp_name'] > and the original name (without path) would be in: > $_FILES['userfile']['name']. > > Since you didn't mention anything about this Lukas, I'm guessing there > is no file server-side with Seaside, just the data held in an object. If > that's the case, then I guess you just open an output stream and write > out the data to a file of your choosing William. Aha, ok I see. Seaside doesn't save the uploaded file anywhere automatically, that's up to the developer to decide where to put it. Maybe you want to save it to the file-system, maybe you want it in a database, maybe you want to mail it somewhere, ... it is up to you. > > SECOND : How could I create a WAFile class object using only the > fullPath of a file ? > > I guess you'd just set the content: to an opened file-stream. Any > experienced smalltalkers know better? Yeah, try something like (assuming that file is an instance of WAFile): stream := FileDirectory default fileNamed: file fileName. [ stream binary; nextPutAll: file contents ] ensure: [ stream close ] Then you have stored your file in the directory with your image. Probably you should change 'FileDirectory default' to a different subdirectory, to avoid accidental overriding of your image. Cheers, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ Seaside mailing list [hidden email] http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside |
Free forum by Nabble | Edit this page |