开发者

Strange behavior with the method getUploadedBlobs

开发者 https://www.devze.com 2023-04-08 03:33 出处:网络
I\'ve a problem with the methode blobstoreService.getUploadedBlobs(). I\'ve a JSP page in wich one I set an uploader like this :

I've a problem with the methode blobstoreService.getUploadedBlobs(). I've a JSP page in wich one I set an uploader like this :

<formname='form'  action='<%= blobstoreService.createUploadUrl("/Edit_Engine") %>' method='POST' enctype='multipart/form-data' >
<input label='...' multiple='false' name='myFile' />
//...and multiple input for text
</form>

and I retrieve this code with my servlet :

java.util.Map<String,BlobKey> blobs = blobstoreService.getUploadedBlobs(req);
BlobKey blobK  = blobs.get("myFiles[]"); //I don't know why I need to add the characters 's[]' at the end...

But the behavior is strange. The first time I upload an image, everything works. However, the s开发者_JS百科econd time, I send my form without uploading somehting (only text data), and then my java code finds a BlobKey. But this BlobKey seems to be the previous sended data, or a corrupted data. I mean that not normal, because when I deploy this version on my localhost, if the form uploads no file the method getUploadedBlobs returns an empty HashMap. However, when I deploy on google servers, if the form uploads no file, the method getUploadedBlobs seems to return a HashMap with wrong data.

Could you help me? Or tell me if this behaviro is normal...

Many thanks,

bat


If you're getting a valid BlobKey, then myFiles[] is most likely the name given to the file input field in the form. Is that the case? That seems like an odd name for an input field. Are you using a template library to help generate HTML from the JSP?

0

精彩评论

暂无评论...
验证码 换一张
取 消