dimanche 6 septembre 2015

JSP can send file to AWS bucket using static source file address in the code, but doesn't work dynamically

I have following line in my code to send file to AWS cloud.

s3Client.putObject(new PutObjectRequest(bucket, fileName, 
                new File("/Users/MyFolder/Desktop/Test/logo.jpg")).withCannedAcl(CannedAccessControlList.PublicRead));          
    }

I have following line in my HTML code to point to the source file.

<tr>
        <td><b>Select a Logo:</b></td>
        <td><INPUT NAME="file" TYPE="file"></td>
</tr>

When the html code is send by clicking send button, It should send the file to my JSP page, that I can use instead of

"/Users/MyFolder/Desktop/Test/logo.jpg"

in my code.

I know it can be done using creating a blank object in my AWS cloud, sending bytes to the newly created file, and changing its file extension with metadata. Just can't stream it correctly. Getting a bunch of errors when trying to replace the static path.




Aucun commentaire:

Enregistrer un commentaire