summaryrefslogtreecommitdiffstats
path: root/WebCore/html/File.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/html/File.cpp')
-rw-r--r--WebCore/html/File.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/WebCore/html/File.cpp b/WebCore/html/File.cpp
index 2c9ce53..4000dcb 100644
--- a/WebCore/html/File.cpp
+++ b/WebCore/html/File.cpp
@@ -34,6 +34,19 @@ namespace WebCore {
File::File(const String& path)
: Blob(path)
{
+ Init();
+}
+
+#if ENABLE(DIRECTORY_UPLOAD)
+File::File(const String& relativePath, const String& filePath)
+ : Blob(FileBlobItem::create(filePath, relativePath))
+{
+ Init();
+}
+#endif
+
+void File::Init()
+{
// We don't use MIMETypeRegistry::getMIMETypeForPath() because it returns "application/octet-stream" upon failure.
const String& fileName = name();
int index = fileName.reverseFind('.');
@@ -46,4 +59,11 @@ const String& File::name() const
return items().at(0)->toFileBlobItem()->name();
}
+#if ENABLE(DIRECTORY_UPLOAD)
+const String& File::webkitRelativePath() const
+{
+ return items().at(0)->toFileBlobItem()->relativePath();
+}
+#endif
+
} // namespace WebCore