WOFileUpload and DefaultFileRenamePolicy
WOFileUpload and DefaultFileRenamePolicy
- Subject: WOFileUpload and DefaultFileRenamePolicy
- From: Erwin <email@hidden>
- Date: Wed, 29 Dec 2004 17:36:57 +0100
Using WOFileUpload component, (WO5.3.2), I am trying to use the DefaultFileRenamePolicy class (from the cos package - com.oreilly.servlet)
to change the filename when it already exists (adding an integer at the end... is the default policy)
DefaultFileRenamePolicy dfrp = new DefaultFileRenamePolicy();
....
File uploadedFile = dfrp.rename(new File(actualFilePath));
it's running well (creating image2.jpg, image3.jpg, etc...) excepted during the first upload,
the later instruction
is creating the first file : image.jpg and ALSO the image1.jpg ...
I believe I rather should have 2 instructions , but I don't see how to test which one to use in clickSubmitted
// for the 1st upload
File uploadedFile = new File(actualFilePath);
// and for the subsequent uploads...
File uploadedFile = dfrp.rename(new File(actualFilePath));
here is the .wod
FileName: WOString {
value = actualFilePath;
}
Form1: WOForm {
enctype = "multipart/form-data";
}
Hyperlink1: WOHyperlink {
action = returnToReferringPage;
}
ShowFile: WOConditional {
condition = hasFile;
}
SubmitButton1: WOSubmitButton {
action = submitClicked;
value = "Click here when done";
}
Upload1: WOFileUpload {
streamToFilePath = dynamicName;
finalFilePath = actualFilePath;
overwrite = false;
bufferSize = 2000;
filePath = aFileName;
size = "40";
mimeType = aMimeType;
} _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden