on 09-20-2007 8:01 AM
Hi Experts,
I have successfully completed <b>Uploading_and_Downloading_files_NW04s_Init</b> (download upload tutorial).
I don't know upload files where it is stored(which location)?
give ur valuable suggestions...
Regards,
P.Manivannan.
If the file is successfully uploaded, it's content is stored in the Web Dynpro context. If you want to save it to disk, you could add the following code to the onActionUploadFile method.
//IWDModifiableBinaryType binaryType =
//byte[] file =
writeByteArrayToFile(new File("/tmp/" + binaryType.getFileName()), file);
The next code is copied from Commons IO's FileUtils
public static FileOutputStream openOutputStream(File file) throws IOException {
if (file.exists()) {
if (file.isDirectory()) {
throw new IOException("File '" + file + "' exists but is a directory");
}
if (file.canWrite() == false) {
throw new IOException("File '" + file + "' cannot be written to");
}
} else {
File parent = file.getParentFile();
if (parent != null && parent.exists() == false) {
if (parent.mkdirs() == false) {
throw new IOException("File '" + file + "' could not be created");
}
}
}
return new FileOutputStream(file);
}
public static void writeByteArrayToFile(File file, byte[] data) throws IOException {
OutputStream out = null;
try {
out = openOutputStream(file);
out.write(data);
} finally {
closeQuietly(out);
}
}
public static void closeQuietly(OutputStream output) {
try {
if (output != null) {
output.close();
}
} catch (IOException ioe) {
// ignore
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
You can see your doc in portal content database pcd, or
while uploading you have specified a path check that path
Regards
Abhijith YS
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Please go through each and every reply in the following link you can get it, dont neglect this thread even if it shows not answered it has solved problem i believe
1 . /thread/99778 [original link is broken]
2 . /thread/310661 [original link is broken]
3. /thread/66561 [original link is broken]
You can also see to a) https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/kmc/knowledge%20ma...
b) http://help.sap.com/saphelp_nw04/helpdata/en/2a/1d95a6ff8e5b49a51960210374ba5b/frameset.htm
Regards
Abhijith YS
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.