Hope you can help me out. I couldn't find any answers to my question
I've got this part of JSP code:
<html:form action="/restricted/gallery/GalleryUpload" method="post" enctype="multipart/form-data">
<table width="98%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="21%" align="right" class="input_head">Upload Image: </td>
<td class="size12_text_red"><html:file property="file" styleId="File"/> <br/>(Contents of zip files will be extracted and uploaded individually)</td>
</tr>
<tr align="center">
<td colspan="4"><input name="upload2" type="submit" id="upload" class="butt_style" value="Submit"/></td>
</tr>
</table>
Then I i'm passing the data through to the Java class:
else if (req.getParameter("upload2") != null) {
String existingBucketName = "BUCKETNAME";
String filePath = cform.getFile().toString();
String keyName = filePath.substring(filePath.lastIndexOf("/")+1);
String amazonFileUploadLocationOriginal=existingBucketName+"/gallery/"+user.getOwnerId()+"/album_name";
AmazonS3 s3Client = new AmazonS3Client(new PropertiesCredentials(SouthdownsServicesAction.class.getResourceAsStream("AwsCredentials.properties")));
FileInputStream stream = new FileInputStream(filePath);
ObjectMetadata objectMetadata = new ObjectMetadata();
PutObjectRequest putObjectRequest = new PutObjectRequest(amazonFileUploadLocationOriginal, keyName, stream, objectMetadata);
PutObjectResult result = s3Client.putObject(putObjectRequest);
So what i'm trying to do is, in the filePath section i'm trying to pass the full path from the input form file you've selected to there but it simply doesn't work. If i change that filePath to a simple path located on my local machine it works fine. Like the following:
String filePath = "C://Pics//logo.jpg";
Then if i upload a ZIP file instead of an image how will it extract the ZIP content and upload all files individually?
Thanks in advance