org.apache.tapestry.request
Interface IUploadFile

All Known Implementing Classes:
UploadPart

public interface IUploadFile

Represents a file uploaded from a client side form.

Since:
1.0.8
Version:
$Id: IUploadFile.java 243791 2004-02-19 17:38:13Z hlship $
Author:
Howard Lewis Ship

Method Summary
 String getContentType()
          Returns the MIME type specified when the file was uploaded.
 String getFileName()
          Returns the name of the file that was uploaded.
 String getFilePath()
          Returns the complete path, as reported by the client browser.
 long getSize()
          Returns the size, in bytes, of the uploaded content.
 InputStream getStream()
          Returns an input stream of the content of the file.
 boolean isInMemory()
          Returns true if the uploaded content is in memory.
 void write(File file)
          Writes the content of the file to a known location.
 

Method Detail

getFileName

String getFileName()
Returns the name of the file that was uploaded. This is just the filename portion of the complete path.


getFilePath

String getFilePath()
Returns the complete path, as reported by the client browser. Different browsers report different things here.

Since:
2.0.4

getStream

InputStream getStream()
Returns an input stream of the content of the file. There is no guarantee that this stream will be valid after the end of the current request cycle, so it should be processed immediately.

As of release 1.0.8, this will be a a ByteArrayInputStream, but that, too, may change (a future implementation may upload the stream to a temporary file and return an input stream from that).


getContentType

String getContentType()
Returns the MIME type specified when the file was uploaded. May return null if the content type is not known.

Since:
2.2

write

void write(File file)
Writes the content of the file to a known location. This should be invoked at most once. In a standard implementation based on Jakarta FileUpload, this will often be implemented efficiently as a file rename.

Since:
3.0

isInMemory

boolean isInMemory()
Returns true if the uploaded content is in memory. False generally means the content is stored in a temporary file.


getSize

long getSize()
Returns the size, in bytes, of the uploaded content.

Since:
3.0