Questions tagged [fileitem]

13 questions
3
votes
1 answer

Convert FileItem to File

I'm trying to upload a XML file (text.xml) using a simple upload html form, regulary read it as FileItem in the servlet and then get the ACTUAL file (text.xml) so i can print it, save it etc. Is there any educated way to do this simply? some people…
Udi Livne
  • 127
  • 2
  • 3
  • 11
2
votes
1 answer

Can we create FileItem object from file name and location?

Can we create FileItem object from given file name and file location using Java? If we use commons-fileupload jar we can upload file using jsp/html and in servlet on parsing request we will get List. But I want to do file upload using…
CodeName007
  • 51
  • 1
  • 1
  • 6
2
votes
1 answer

"rename" FileItem

From the business prespective, here's the problem We have a number of shared folders that people use, let's call it //shared/the/drive. However, our server might know this shared drive as some other name, perhaps…
corsiKa
  • 81,495
  • 25
  • 153
  • 204
1
vote
0 answers

UnTar and Upload a .tar.gz file maintaining the same folder structure in SpringBoot

I currently have a .tar.gz file with the following files and folders, that I am uploading using springboot dir1/ -file1 dir2/ -file2 -file3 dir3/ -file4 -file5 With my current code, I am able to extract…
user1971376
  • 93
  • 1
  • 4
  • 10
1
vote
0 answers

How to untar a .tar.gz MultipartFile and add the files to List or List

I am sending .tar.gz MultipartFile in my api request, and I want to untar and store all the files in List or List So Far I have... public void importFilesTar(MultipartFile file) throws ContentRepositoryDaoException, Exception { …
user1971376
  • 93
  • 1
  • 4
  • 10
1
vote
3 answers

How do I get an FileInputStream from FileItem in java?

I am trying to avoid the FileItem getInputStream(), because it will get the wrong encoding, for that I need a FileInputStream instead. Is there any way to get a FileInputStream without using this method? Or can I transform my fileitem into a…
1
vote
1 answer

GWTUpload InputStream returning -1

I am having a problem with parsing a CSV file after uploading it to GAE using GWTUpload. The upload seems to work fine but I am having a problem reading data from the file using the getInputStream method from FileItem. My code looks like this: for…
1
vote
2 answers

Get absolute filepath

I have org.springframework.web.multipart.commons.CommonsMultipartFile object and i need to get absolute file path on client device. Thanks I need to show picture to user, without saving on server.
Srw
  • 69
  • 10
1
vote
0 answers

I have following code to upload my attachment.But I couldn't upload it into my own path. How should I change following code?

if (isMultipart) { FileItemFactory factory = new DiskFileItemFactory(); ServletFileUpload upload = new ServletFileUpload(factory); try { // Parse the request List /* FileItem */ items =…
0
votes
0 answers

Partial string when converting fileupload formdata to base64

Im trying to convert a fileupload form data to base64. An ajax post sends the form data to backend. $( "#profileModalForm" ).submit(function( event ) { var formData = new FormData(this); $.ajax({ cache: false, url:…
0
votes
1 answer

Convert File to FileItem Using Scala

I have a web UI that accepts a file uploaded as scalatra.servlet.FileItem and is passed to several functions that do something with the file uploaded. This is working properly. Now, I need to make a junit test for this feature. With this junit test,…
oneDerer
  • 287
  • 3
  • 10
0
votes
2 answers

Using Collections on Java, Apache FileItem sort()

How can I sort a FileItem list? I have the next code: import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.disk.DiskFileItemFactory; import org.apache.commons.fileupload.servlet.ServletFileUpload; List items…
0
votes
0 answers

List is null when uploading file

I am trying to store a file along with two other values which are inputted in the text fields (orderid2 and remarks) in the database. However, the List< FileItem > is null. I do not know what is wrong with my code.. It is not doing the while…
nubteens
  • 5,462
  • 4
  • 20
  • 31