質問

I created an upload form for images, which works properly and saves files in Contents/Resources/uploads.

I now want to display those images in my web app: how do I retrieve the URL?

役に立ちましたか?

解決

To display a Seaside image, you'd use...

html url: <some image resource>

...if that image is in your Seaside image, the image resource can be coded as...

html url: WAFileLibrary / #myNewImagePng 

...which translates as...

html url: '/files/WAFileLibrary/myNewImage.png'

Normally a subclass of WAFileLibrary would be used for your application.

他のヒント

It is not a question of Seaside but of the Webserver you use.

If you use Apache to serve the static files, you find the mechanism described here: Mapping URLs to Filesystem Locations

If you work on Pharo, during development you could use Zinc webserver to serve static files:

ZnZincStaticServerAdaptor startOn: 8080 andServeFilesFrom: '/Path/to/the/images'

In this case the URL to upload.jpg in '/Path/to/the/images' would be for example http://localhost:8080/upload.jpg

You need to configure your server to serve the files from your upload directory. Either Apache or your Smalltalk web server. Then you'll probably want to use #resourceUrl:

Check out the following chapters in the Seaside book

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top