Menu

uploaded file url

Will
2013-04-02
2013-04-02
  • Will

    Will - 2013-04-02

    With the GWT File Uploader you can easily get the file url from the uploader. What is the equivalent mechanism that I can use in order to access or get the location of the uploaded file.

     
  • Shawn Quinn

    Shawn Quinn - 2013-04-02

    I'm not sure I follow your question. Are you asking about how to get the location of the file on the end users computer? Or the location of the file after it is uploaded to the server? I don't believe the former is currently possible (at least not in a cross-browser compatible way), however the name of the file (without the path) is available on the client side. The later is certainly possible, but it would depend on what library you're using on the server to receive the file. If you're using the Apache Commons File Upload library it would be something like the following (assuming that you're uploading the files to disk instead of in-memory):

    if(item instanceof DiskFileItem) {
        System.out.println("File path: " + ((DiskFileItem)item).getStoreLocation().getAbsolutePath());
    }
    

    Hope that helps,

    -Shawn

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.