2013-04-26 139 views
0

我上传到我的应用程序,图像并将它们保存在web-app/myCustomFolderImages中。 当我想删除一些这方面的图片,我有2个问题:删除上传的图片

  1. 有时,当我在上传后立即删除文件,我不能做到这一点,javaw.exe的阻止文件。有什么东西在缓存这个文件?

  2. 主要问题,当我删除一个文件,并上传接下来,控制台写这个堆栈:

Resource reload failed!: 
java.io.FileNotFoundException: URL [file:.../z5c2ex/004_1_-thumbnail.jpg] cannot be resolved in the file system for resolving its last-modified timestamp 
    at org.springframework.core.io.AbstractResource.lastModified(AbstractResource.java:144) 
    at org.springframework.core.io.AbstractFileResolvingResource.lastModified(AbstractFileResolvingResource.java:173) 
    at org.springframework.core.io.Resource$lastModified.call(Unknown Source) 
    at org.grails.plugin.resource.ResourceMeta.isDirty(ResourceMeta.groovy:147) 
    at sun.reflect.GeneratedMethodAccessor679.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
    at java.lang.reflect.Method.invoke(Method.java:601) 
    at org.springsource.loaded.ri.OriginalClassInvoker.invoke(OriginalClassInvoker.java:47) 
    at org.springsource.loaded.ri.ReflectiveInterceptor.jlrMethodInvoke(ReflectiveInterceptor.java:1272)... 

Grails的资源插件,这些图片是静态的。当我使用grails.resources.adhoc.excludes选项时,我的图像根本不在网站上呈现。

有没有什么好的方法来从grails应用程序动态上传和删除图像(文件)?

+0

我解决了这个问题,解决方法很简单。我直接访问图片(myapp.com/imagesFolder/image.jpg),而不是通过资源插件(而不是通过grails标签)。 – user2040547 2013-05-12 12:14:11

回答

1

的OP写道:

我解决了这个问题,解决方案很简单:我(myapp.com/imagesFolder/image.jpg),而不是由资源插件直接访问图像(不是Grails标记<g:img>)。

+0

([问题在评论中解决并转换为社区wiki](http://meta.stackoverflow.com/questions/251597/question-with-no-answers-but-issue-solved-in-the-comments? RQ = 1)。) – 2015-07-04 20:00:23