file upload - form enctype="multipart/form-data" returning contentType null in JSP RAD environment -


I am following an example to fileUpload on the JSP page on this link: It looks very straightforward and I am able to call uploadedFile.jsp to upload the upload, except that the request.getContentType () is returning to the tap. Looks like the content type is not being set correctly, like myspace = "multipart / form-data" or encoding = "multipart / form-data". My JSP:

  & Lt; H3 & gt; File uploads: & lt; / H3 & gt; Choose a file to upload: & lt; Br / & gt; & Lt; form name = "uploadform" method = "post" encoding = "multipart / form-data" enctype = "multipart / form-data" & gt; & Lt; Input type = "file" name = "file" size = "50" /> gt; & Lt; Br / & gt; & Lt; Input type = "button" class = "button1" value = "upload file" onClick = "submit file upload ();" / & Gt; & Lt; / Form & gt;   

And here is the snippet from uploadFile.jsp where I am getting empty: string contentType = request.getContentType ();

I am using RAD in JAP environment and this does not seem to work either in IE 10 or Chrome I have searched extensivley on this error, but why can it be any reason Can not find that it works for most people Please help me!

I see that you have distracted with the tutorial, where they are

  & lt; Input type = "submit" value = "upload file" />   

You have

  & lt; Input type = "button" class = "button1" value = "upload file" onClick = "submitFileUpload ();" / & Gt;   

Why? If you are trying to do Ajax, then you have a problem. Setting the encoding type on the form is not helping you, if you are not actually using the form, but using Ajax.

You should post the definition for the javascript function submitFileUpload .

On that part you should probably follow the tutorial of the letter. But at another point you should distract: To process the upload in the backend, you should not use a service JSP. Also, it would be a good idea to look at examples because some modes in the library can change in some ways.

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -