I am trying to upload file to google sites and am obtaining the stream using apache commons file upload. I get the input stream as under
InputStream is = fileItem.openStream();
How will I convert this input stream in file object so that below call succeeds and I am able to set the MediaFileSource to above conv开发者_高级运维erted file.
AttachmentEntry newAttachment = new AttachmentEntry();
newAttachment.setMediaSource(new MediaFileSource(file, fileMimeType));
You could use MediaStreamSource
instead of MediaFileSource
.
You have no write access to a file system on AppEngine and you're supposed to keep your data in datastore. However, gaefs project gives you a virtual file system and, as to the best pf my knowledge, supports file uploading.
精彩评论